diff options
author | Sage Weil <sage@inktank.com> | 2013-05-08 14:54:33 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-08 14:54:33 -0700 |
commit | e2528ae42c455c522154c9f68b5032a3362fca8e (patch) | |
tree | a05b1f46a0a3408c09451f5c3ecf3cd4b190658e | |
parent | f2a54cc9c98a9f31aef049c74ea932b2d9000d3c (diff) | |
download | ceph-e2528ae42c455c522154c9f68b5032a3362fca8e.tar.gz |
ceph-create-keys: gracefully handle no data from admin socket
Old ceph-mon (prior to 393c9372f82ef37fc6497dd46fc453507a463d42) would
return an empty string and success if the command was not registered yet.
Gracefully handle that case by retrying.
If we still fail to parse, exit entirely with EINVAL.
Fixes: #4952
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@intank.com>
-rwxr-xr-x | src/ceph-create-keys | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ceph-create-keys b/src/ceph-create-keys index bb3967c0879..23632dd2075 100755 --- a/src/ceph-create-keys +++ b/src/ceph-create-keys @@ -34,7 +34,17 @@ def wait_for_quorum(cluster, mon_id): time.sleep(1) continue - data = json.loads(out) + if out == '': + LOG.info('ceph-mon admin socket returned no data') + time.sleep(1) + continue + + try: + data = json.loads(out) + except: + LOG.info('failed to parse json %s', out) + sys.exit(errno.EINVAL) + state = data['state'] if state not in QUORUM_STATES: LOG.info('ceph-mon is not in quorum: %r', state) |