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)
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)