From: Kefu Chai Date: Thu, 21 Jan 2021 16:11:39 +0000 (+0800) Subject: pybind/mgr/cephadm: return -ENOENT if self.ssh_user is None X-Git-Tag: v17.1.0~3164^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38935%2Fhead;p=ceph.git pybind/mgr/cephadm: return -ENOENT if self.ssh_user is None there is chance that self.ssh_user is None when handling "cephadm get-user" command, so return -ENOENT and error messages in that case. Signed-off-by: Kefu Chai --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 9f0895ff363e..f389c57483a7 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -819,7 +819,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, """ Show user for SSHing to cluster hosts """ - return 0, self.ssh_user, '' + if self.ssh_user is None: + return -errno.ENOENT, '', 'No cluster SSH user configured' + else: + return 0, self.ssh_user, '' @orchestrator._cli_read_command( 'cephadm set-user')