]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: PEP8tify inventory.py 36792/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Tue, 25 Aug 2020 13:29:36 +0000 (15:29 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 25 Aug 2020 13:29:36 +0000 (15:29 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/inventory.py

index 4b0154e75a56527d90e4c28ab728c8d3cf318064..4b5fc0f5398cf24c0f7ec5cbc4ca7b0059ee4df4 100644 (file)
@@ -88,11 +88,11 @@ class Inventory:
     def spec_from_dict(self, info):
         hostname = info['hostname']
         return HostSpec(
-                hostname,
-                addr=info.get('addr', hostname),
-                labels=info.get('labels', []),
-                status='Offline' if hostname in self.mgr.offline_hosts else info.get('status', ''),
-            )
+            hostname,
+            addr=info.get('addr', hostname),
+            labels=info.get('labels', []),
+            status='Offline' if hostname in self.mgr.offline_hosts else info.get('status', ''),
+        )
 
     def all_specs(self) -> Iterator[HostSpec]:
         return map(self.spec_from_dict, self._inventory.values())
@@ -105,9 +105,9 @@ class SpecStore():
     def __init__(self, mgr):
         # type: (CephadmOrchestrator) -> None
         self.mgr = mgr
-        self.specs = {} # type: Dict[str, ServiceSpec]
-        self.spec_created = {} # type: Dict[str, datetime.datetime]
-        self.spec_preview = {} # type: Dict[str, ServiceSpec]
+        self.specs = {}  # type: Dict[str, ServiceSpec]
+        self.spec_created = {}  # type: Dict[str, datetime.datetime]
+        self.spec_preview = {}  # type: Dict[str, ServiceSpec]
 
     def load(self):
         # type: () -> None
@@ -162,6 +162,7 @@ class SpecStore():
             service_name, specs))
         return specs
 
+
 class HostCache():
     def __init__(self, mgr):
         # type: (CephadmOrchestrator) -> None
@@ -172,9 +173,9 @@ class HostCache():
         self.osdspec_previews = {}     # type: Dict[str, List[Dict[str, Any]]]
         self.networks = {}             # type: Dict[str, Dict[str, List[str]]]
         self.last_device_update = {}   # type: Dict[str, datetime.datetime]
-        self.daemon_refresh_queue = [] # type: List[str]
-        self.device_refresh_queue = [] # type: List[str]
-        self.osdspec_previews_refresh_queue = [] # type: List[str]
+        self.daemon_refresh_queue = []  # type: List[str]
+        self.device_refresh_queue = []  # type: List[str]
+        self.osdspec_previews_refresh_queue = []  # type: List[str]
 
         # host -> daemon name -> dict
         self.daemon_config_deps = {}   # type: Dict[str, Dict[str, Dict[str,Any]]]
@@ -286,7 +287,7 @@ class HostCache():
         if host in self.last_device_update:
             del self.last_device_update[host]
         self.mgr.event.set()
-    
+
     def distribute_new_registry_login_info(self):
         self.registry_login_queue = set(self.mgr.inventory.keys())
 
@@ -299,9 +300,11 @@ class HostCache():
             'daemon_config_deps': {},
         }
         if host in self.last_daemon_update:
-            j['last_daemon_update'] = self.last_daemon_update[host].strftime(DATEFMT) # type: ignore
+            j['last_daemon_update'] = self.last_daemon_update[host].strftime(
+                DATEFMT)  # type: ignore
         if host in self.last_device_update:
-            j['last_device_update'] = self.last_device_update[host].strftime(DATEFMT) # type: ignore
+            j['last_device_update'] = self.last_device_update[host].strftime(
+                DATEFMT)  # type: ignore
         for name, dd in self.daemons[host].items():
             j['daemons'][name] = dd.to_json()  # type: ignore
         for d in self.devices[host]:
@@ -470,7 +473,7 @@ class HostCache():
             return True
         # already up to date:
         return False
-    
+
     def update_last_etc_ceph_ceph_conf(self, host: str):
         if not self.mgr.last_monmap:
             return
@@ -510,7 +513,7 @@ class EventStore():
     def __init__(self, mgr):
         # type: (CephadmOrchestrator) -> None
         self.mgr: CephadmOrchestrator = mgr
-        self.events = {} # type: Dict[str, List[OrchestratorEvent]]
+        self.events = {}  # type: Dict[str, List[OrchestratorEvent]]
 
     def add(self, event: OrchestratorEvent) -> None:
 
@@ -527,7 +530,8 @@ class EventStore():
         self.events[event.kind_subject()] = self.events[event.kind_subject()][-5:]
 
     def for_service(self, spec: ServiceSpec, level, message) -> None:
-        e = OrchestratorEvent(datetime.datetime.utcnow(), 'service', spec.service_name(), level, message)
+        e = OrchestratorEvent(datetime.datetime.utcnow(), 'service',
+                              spec.service_name(), level, message)
         self.add(e)
 
     def from_orch_error(self, e: OrchestratorError):
@@ -540,7 +544,6 @@ class EventStore():
                 str(e)
             ))
 
-
     def for_daemon(self, daemon_name, level, message):
         e = OrchestratorEvent(datetime.datetime.utcnow(), 'daemon', daemon_name, level, message)
         self.add(e)