From: Sage Weil Date: Thu, 5 Mar 2020 15:18:50 +0000 (-0600) Subject: mgr/orch: from_strings -> from_string; do not accept a list X-Git-Tag: v15.1.1~74^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d3ba225f2abf8035d13d86e802c96af8b4204b1e;p=ceph.git mgr/orch: from_strings -> from_string; do not accept a list Normalize all callers to pass a single string. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/tests/test_scheduling.py b/src/pybind/mgr/cephadm/tests/test_scheduling.py index b00bf365fcc6..940bd43edd19 100644 --- a/src/pybind/mgr/cephadm/tests/test_scheduling.py +++ b/src/pybind/mgr/cephadm/tests/test_scheduling.py @@ -209,7 +209,7 @@ def test_node_assignment3(service_type, placement, hosts, ]) def test_bad_placements(placement): try: - s = PlacementSpec.from_strings(placement.split(' ')) + s = PlacementSpec.from_string(placement.split(' ')) assert False except OrchestratorValidationError as e: pass diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 8d83c9acbdf6..3f0e5dab5792 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1312,25 +1312,25 @@ class PlacementSpec(object): raise OrchestratorValidationError("num/count must be > 1") @classmethod - def from_strings(cls, arg): + def from_string(cls, arg): # type: (Optional[str]) -> PlacementSpec """ A single integer is parsed as a count: - >>> PlacementSpec.from_strings('3'.split()) + >>> PlacementSpec.from_string('3') PlacementSpec(count=3) A list of names is parsed as host specifications: - >>> PlacementSpec.from_strings('host1 host2'.split()) + >>> PlacementSpec.from_string('host1 host2') PlacementSpec(label=[HostSpec(hostname='host1', network='', name=''), HostSpec(hostname='host2', network='', name='')]) You can also prefix the hosts with a count as follows: - >>> PlacementSpec.from_strings('2 host1 host2'.split()) + >>> PlacementSpec.from_string('2 host1 host2') PlacementSpec(label=[HostSpec(hostname='host1', network='', name=''), HostSpec(hostname='host2', network='', name='')], count=2) You can spefify labels using `label: