From 688bd974e3c93367119ca91d742ccda2b5981333 Mon Sep 17 00:00:00 2001 From: Adam King Date: Wed, 5 May 2021 13:47:39 -0400 Subject: [PATCH] mgr/cephadm: misc. autopep8 changes Some of the file in mgr/cephadm are getting changed every time I want to run the mgr tox tests to check changes and it's inconvenient to have to check the files out every time Signed-off-by: Adam King (cherry picked from commit 7a3ec28cc47ffba044f3820deee77f70b496fce7) --- src/pybind/mgr/cephadm/inventory.py | 1 + src/pybind/mgr/cephadm/schedule.py | 3 ++- src/pybind/mgr/cephadm/serve.py | 9 ++++++--- src/pybind/mgr/cephadm/tests/test_cephadm.py | 6 ++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index d2c6e895a31d1..81089a26437a9 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -232,6 +232,7 @@ class ClientKeyringSpec(object): """ A client keyring file that we should maintain """ + def __init__( self, entity: str, diff --git a/src/pybind/mgr/cephadm/schedule.py b/src/pybind/mgr/cephadm/schedule.py index dbe723875049e..92ff8f999da3f 100644 --- a/src/pybind/mgr/cephadm/schedule.py +++ b/src/pybind/mgr/cephadm/schedule.py @@ -27,7 +27,8 @@ class DaemonPlacement(NamedTuple): if self.name: other.append(f'name={self.name}') if self.ports: - other.append(f'{self.ip or "*"}:{self.ports[0] if len(self.ports) == 1 else ",".join(map(str, self.ports))}') + other.append( + f'{self.ip or "*"}:{self.ports[0] if len(self.ports) == 1 else ",".join(map(str, self.ports))}') if other: res += '(' + ' '.join(other) + ')' return res diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index c458b213cd205..3206d10491663 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -157,7 +157,8 @@ class CephadmServe: 0o644, 0, 0, bytes(config), str(config_digest) ) except Exception as e: - self.mgr.log.warning(f'unable to calc conf hosts: {self.mgr.manage_etc_ceph_ceph_conf_hosts}: {e}') + self.mgr.log.warning( + f'unable to calc conf hosts: {self.mgr.manage_etc_ceph_ceph_conf_hosts}: {e}') # client keyrings for ks in self.mgr.keys.keys.values(): @@ -171,7 +172,8 @@ class CephadmServe: if ret: self.log.warning(f'unable to fetch keyring for {ks.entity}') continue - digest = ''.join('%02x' % c for c in hashlib.sha256(keyring.encode('utf-8')).digest()) + digest = ''.join('%02x' % c for c in hashlib.sha256( + keyring.encode('utf-8')).digest()) ha = HostAssignment( spec=ServiceSpec('mon', placement=ks.placement), hosts=self.mgr._schedulable_hosts(), @@ -189,7 +191,8 @@ class CephadmServe: ks.mode, ks.uid, ks.gid, keyring.encode('utf-8'), digest ) except Exception as e: - self.log.warning(f'unable to calc client keyring {ks.entity} placement {ks.placement}: {e}') + self.log.warning( + f'unable to calc client keyring {ks.entity} placement {ks.placement}: {e}') @forall_hosts def refresh(host: str) -> None: diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index 1fcaa44b34920..2fea77eb3cba9 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -1095,10 +1095,12 @@ class TestCephadm(object): assert '/etc/ceph/ceph.conf' in cephadm_module.cache.get_host_client_files('test') # Make sure, _check_daemons does a redeploy due to monmap change: - before_digest = cephadm_module.cache.get_host_client_files('test')['/etc/ceph/ceph.conf'][0] + before_digest = cephadm_module.cache.get_host_client_files('test')[ + '/etc/ceph/ceph.conf'][0] cephadm_module._set_extra_ceph_conf('[mon]\nk2=v2') CephadmServe(cephadm_module)._refresh_hosts_and_daemons() - after_digest = cephadm_module.cache.get_host_client_files('test')['/etc/ceph/ceph.conf'][0] + after_digest = cephadm_module.cache.get_host_client_files('test')[ + '/etc/ceph/ceph.conf'][0] assert before_digest != after_digest def test_etc_ceph_init(self): -- 2.39.5