]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: catch Exception during is_mgr_available 34718/head
authorMichael Fritch <mfritch@suse.com>
Thu, 23 Apr 2020 21:09:03 +0000 (15:09 -0600)
committerMichael Fritch <mfritch@suse.com>
Thu, 23 Apr 2020 21:12:56 +0000 (15:12 -0600)
Traceback (most recent call last):
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 4578, in <module>
    r = args.func()
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 1121, in _default_image
    return func()
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 2489, in command_bootstrap
    is_available('mgr', is_mgr_available)
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 895, in is_available
    if func():
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 2486, in is_mgr_available
    out = cli(['status', '-f', 'json-pretty'], timeout=timeout)
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 2403, in cli
    return CephContainer(
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 2140, in run
    out, _, _ = call_throws(
  File "test_tmp/tmp.ykMmPiFqIT/cephadm", line 838, in call_throws
    raise RuntimeError('Failed command: %s' % ' '.join(command))

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index dca6ad273ef40d062a0439234267b7bc2b58ceb2..d8c44434d3dd3915e3e6925962c1d413632f062c 100755 (executable)
@@ -892,6 +892,8 @@ def is_available(what, func):
     num = 1
     while True:
         if func():
+            logger.info('%s is available'
+                    % (what))
             break
         elif num > retry:
             raise Error('%s not available after %s tries'
@@ -2482,9 +2484,13 @@ def command_bootstrap():
     def is_mgr_available():
         # type: () -> bool
         timeout=args.timeout if args.timeout else 30 # seconds
-        out = cli(['status', '-f', 'json-pretty'], timeout=timeout)
-        j = json.loads(out)
-        return j.get('mgrmap', {}).get('available', False)
+        try:
+            out = cli(['status', '-f', 'json-pretty'], timeout=timeout)
+            j = json.loads(out)
+            return j.get('mgrmap', {}).get('available', False)
+        except Exception as e:
+            logger.debug('status failed: %s' % e)
+            return False
     is_available('mgr', is_mgr_available)
 
     # wait for mgr to restart (after enabling a module)