From 36dde8861a1b8ae0aa53926c773e21bfa065fb07 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 22 Jan 2021 00:11:39 +0800 Subject: [PATCH] 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 --- src/pybind/mgr/cephadm/module.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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') -- 2.47.3