From: Sage Weil Date: Tue, 2 Feb 2021 23:07:36 +0000 (-0600) Subject: mgr/cephadm: use datetime_now() for last_facts_update X-Git-Tag: v17.1.0~3046^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=821f7e9d5b5a2d4725c5cea2987e601e07e83558;p=ceph-ci.git mgr/cephadm: use datetime_now() for last_facts_update Be consistent! Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index 82518217748..9340b8bf432 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -298,7 +298,7 @@ class HostCache(): def update_host_facts(self, host, facts): # type: (str, Dict[str, Dict[str, Any]]) -> None self.facts[host] = facts - self.last_facts_update[host] = datetime.datetime.utcnow() + self.last_facts_update[host] = datetime_now() def devices_changed(self, host: str, b: List[inventory.Device]) -> bool: a = self.devices[host] @@ -544,7 +544,7 @@ class HostCache(): if host in self.mgr.offline_hosts: logger.debug(f'Host "{host}" marked as offline. Skipping gather facts refresh') return False - cutoff = datetime.datetime.utcnow() - datetime.timedelta( + cutoff = datetime_now() - datetime.timedelta( seconds=self.mgr.facts_cache_timeout) if host not in self.last_facts_update or self.last_facts_update[host] < cutoff: return True