From: Kefu Chai Date: Thu, 26 Dec 2019 08:29:52 +0000 (+0800) Subject: mgr/orchestrator_cli: avoid negated conditions X-Git-Tag: v15.1.0~318^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=562488d137e317e3e0167964aa46309ddd995380;p=ceph-ci.git mgr/orchestrator_cli: avoid negated conditions for better readability Signed-off-by: Kefu Chai --- diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index ebf40c47225..f437349cf1b 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -623,8 +623,9 @@ Usage: 'Update the number of monitor instances') def _update_mons(self, num=None, hosts=[], label=None): - placement = orchestrator.PlacementSpec(label=label, count=num, hosts=hosts) - if not hosts and not label: + if hosts or label: + placement = orchestrator.PlacementSpec(label=label, count=num, hosts=hosts) + else: # Improve Error message. Point to parse_host_spec examples raise orchestrator.OrchestratorValidationError("Mons need a host spec. (host, network, name(opt))") # TODO: Scaling without a HostSpec doesn't work right now.