]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-create-keys: gracefully handle no data from admin socket
authorSage Weil <sage@inktank.com>
Wed, 8 May 2013 21:54:33 +0000 (14:54 -0700)
committerSage Weil <sage@inktank.com>
Wed, 8 May 2013 21:56:50 +0000 (14:56 -0700)
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>
(cherry picked from commit e2528ae42c455c522154c9f68b5032a3362fca8e)

src/ceph-create-keys

index bb3967c087943cded835ff72ac74ec84e3d823bd..23632dd2075a41505b5a00bddef2576b59ac6aa3 100755 (executable)
@@ -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)