]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/orchestrator_cli: avoid negated conditions
authorKefu Chai <kchai@redhat.com>
Thu, 26 Dec 2019 08:29:52 +0000 (16:29 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 26 Dec 2019 08:31:47 +0000 (16:31 +0800)
for better readability

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/orchestrator_cli/module.py

index ebf40c4722514efeb32a0b724dc58a4f64c820c5..f437349cf1bd1cf2c6d65d474ba9af223b6e9866 100644 (file)
@@ -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.