From: Sebastian Wagner Date: Fri, 24 Jan 2020 11:58:21 +0000 (+0100) Subject: mgr/orchestsrator: make parse_host_specs a classmethod X-Git-Tag: v15.1.1~379^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=06e95b28ac6ca5f9c1debb2d99dd13982fa8ae2f;p=ceph.git mgr/orchestsrator: make parse_host_specs a classmethod Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 576b21dec8e8..1a9114647265 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1089,7 +1089,7 @@ class PlacementSpec(object): if all([isinstance(host, HostPlacementSpec) for host in hosts]): self.hosts = hosts else: - self.hosts = [parse_host_placement_specs(x, require_network=False) for x in hosts if x] + self.hosts = [HostPlacementSpec.parse(x, require_network=False) for x in hosts if x] self.count = count # type: Optional[int] diff --git a/src/pybind/mgr/tests/test_orchestrator.py b/src/pybind/mgr/tests/test_orchestrator.py index a1b6dae3b8f5..acd1b567dc27 100644 --- a/src/pybind/mgr/tests/test_orchestrator.py +++ b/src/pybind/mgr/tests/test_orchestrator.py @@ -9,7 +9,7 @@ from ceph.deployment import inventory from orchestrator import raise_if_exception, RGWSpec, Completion, ProgressReference from orchestrator import InventoryNode, ServiceDescription from orchestrator import OrchestratorValidationError -from orchestrator import parse_host_placement_specs +from orchestrator import HostPlacementSpec @pytest.mark.parametrize("test_input,expected, require_network", @@ -25,7 +25,7 @@ from orchestrator import parse_host_placement_specs ("myhost:[v1:10.1.1.10:6789,v2:10.1.1.11:3000]=sname", ('myhost', '[v1:10.1.1.10:6789,v2:10.1.1.11:3000]', 'sname'), True), ]) def test_parse_host_placement_specs(test_input, expected, require_network): - ret = parse_host_placement_specs(test_input, require_network=require_network) + ret = HostPlacementSpec.parse(test_input, require_network=require_network) assert ret == expected assert str(ret) == test_input @@ -39,7 +39,7 @@ def test_parse_host_placement_specs(test_input, expected, require_network): ]) def test_parse_host_placement_specs_raises(test_input): with pytest.raises(ValueError): - ret = parse_host_placement_specs(test_input) + ret = HostPlacementSpec.parse(test_input) def _test_resource(data, resource_class, extra=None):