chg: containers (podman) - check for open socket eagerly

objective: Know if a podman sock is open. If not, stop pinging it every update
This commit is contained in:
Bharath Vignesh J K 2023-05-14 02:04:45 +05:30
parent bce5d7e6df
commit b1da4f6ff4
1 changed files with 2 additions and 0 deletions

View File

@ -230,6 +230,8 @@ class PodmanContainersExtension:
"""Connect to Podman."""
try:
self.client = PodmanClient(base_url=self.podman_sock)
# PodmanClient works lazily, so make a ping to determine if socket is open
self.client.ping()
except Exception as e:
logger.error("{} plugin - Can't connect to Podman ({})".format(self.ext_name, e))
self.client = None