From: Sage Weil Date: Tue, 5 Nov 2019 16:27:45 +0000 (-0600) Subject: mgr/ssh: raise RuntimeError when ceph-daemon invocation fails X-Git-Tag: v15.1.0~1028^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e38eeb62c51e73264c5318d93eff8ff6cfce3dec;p=ceph.git mgr/ssh: raise RuntimeError when ceph-daemon invocation fails Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 1144278bee2..4471a1c2ac9 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -353,7 +353,8 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): def _run_ceph_daemon(self, host, entity, command, args, stdin=None, - no_fsid=False): + no_fsid=False, + error_ok=False): """ Run ceph-daemon on the remote host with the given command + args """ @@ -392,6 +393,10 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): ['/usr/bin/python', '-u'], stdin=script.encode('utf-8')) self.log.debug('exit code %s out %s err %s' % (code, out, err)) + if code and not error_ok: + raise RuntimeError( + 'ceph-daemon exited with an error code: %d, stderr:%s' % ( + code, '\n'.join(err))) return out, code except Exception as ex: @@ -553,7 +558,8 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): for a in actions[action]: out, code = self._run_ceph_daemon( host, name, 'unit', - ['--name', name, a]) + ['--name', name, a], + error_ok=True) self.log.debug('_service_action code %s out %s' % (code, out)) return "{} {} from host '{}'".format(action, name, host)