From 821f7e9d5b5a2d4725c5cea2987e601e07e83558 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 2 Feb 2021 17:07:36 -0600 Subject: [PATCH] mgr/cephadm: use datetime_now() for last_facts_update Be consistent! Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/inventory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.5