From e88ce2aed746f5c1a40e5d382f6bd50a5133c7ea Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Sun, 16 Jun 2024 14:41:04 +0530 Subject: [PATCH] mgr/cephadm: fix flake8 test failures after a recent update on flake8, some tests in cephadm started failing ``` flake8: commands[0]> flake8 --config=tox.ini alerts balancer cephadm cli_api crash devicehealth diskprediction_local hello iostat localpool nfs orchestrator prometheus rbd_support rgw selftest smb cephadm/configchecks.py:94:6: E204 whitespace after decorator '@' cephadm/module.py:3017:10: E204 whitespace after decorator '@' cephadm/module.py:3344:144: E226 missing whitespace around arithmetic operator cephadm/tests/test_cephadm.py:982:6: E204 whitespace after decorator '@' 3 E204 whitespace after decorator '@' 1 E226 missing whitespace around arithmetic operator ``` Signed-off-by: Nizamudeen A (cherry picked from commit a9563d91c2ac405ae9101bd4e63fa9b749d54432) --- src/pybind/mgr/cephadm/configchecks.py | 2 +- src/pybind/mgr/cephadm/module.py | 4 ++-- src/pybind/mgr/cephadm/tests/test_cephadm.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/cephadm/configchecks.py b/src/pybind/mgr/cephadm/configchecks.py index 9077a1d660130..07ce2926178a3 100644 --- a/src/pybind/mgr/cephadm/configchecks.py +++ b/src/pybind/mgr/cephadm/configchecks.py @@ -91,7 +91,7 @@ class SubnetLookup: speed: [hostname] } - @ property + @property def host_list(self) -> List[str]: hosts = [] for mtu in self.mtu_map: diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 7945f52940b76..7d9e6fd8eeeb1 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2940,7 +2940,7 @@ Then run the following: ) daemons.append(sd) - @ forall_hosts + @forall_hosts def create_func_map(*args: Any) -> str: daemon_spec = self.cephadm_services[daemon_type].prepare_create(*args) with self.async_timeout_handler(daemon_spec.host, f'cephadm deploy ({daemon_spec.daemon_type} daemon)'): @@ -3258,7 +3258,7 @@ Then run the following: (f'The maximum number of {spec.service_type} daemons allowed with {host_count} hosts is {max(5, host_count)}.')) elif spec.service_type != 'osd': if spec.placement.count > (max_count * host_count): - raise OrchestratorError((f'The maximum number of {spec.service_type} daemons allowed with {host_count} hosts is {host_count*max_count} ({host_count}x{max_count}).' + raise OrchestratorError((f'The maximum number of {spec.service_type} daemons allowed with {host_count} hosts is {host_count * max_count} ({host_count}x{max_count}).' + ' This limit can be adjusted by changing the mgr/cephadm/max_count_per_host config option')) if spec.placement.count_per_host is not None and spec.placement.count_per_host > max_count and spec.service_type != 'osd': diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index 2477de13e00a0..9a9f15401f9ae 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -971,7 +971,7 @@ class TestCephadm(object): assert osd_claims.filtered_by_host('host1') == ['0'] assert osd_claims.filtered_by_host('host1.domain.com') == ['0'] - @ pytest.mark.parametrize( + @pytest.mark.parametrize( "ceph_services, cephadm_daemons, strays_expected, metadata", # [ ([(daemon_type, daemon_id), ... ], [...], [...]), ... ] [ -- 2.39.5