chg: containers - use proper names

Other minor syntactic sugar changes
pull/2374/head
Bharath Vignesh J K 2023-05-07 21:47:56 +05:30
parent 9e52775929
commit 8457d2f244
2 changed files with 7 additions and 8 deletions

View File

@ -210,7 +210,7 @@ class DockerContainersExtension:
raise Exception("Missing libs required to run Docker Extension (Containers) ")
self.client = None
self.ext_name = "Docker Ext"
self.ext_name = "containers (Docker)"
self.stats_fetchers = {}
self.connect()
@ -221,7 +221,7 @@ class DockerContainersExtension:
# Do not use the timeout option (see issue #1878)
self.client = docker.from_env()
except Exception as e:
logger.error("docker plugin - Can not connect to Docker ({})".format(e))
logger.error("{} plugin - Can't connect to Docker ({})".format(self.ext_name, e))
self.client = None
def stop(self):
@ -245,7 +245,7 @@ class DockerContainersExtension:
version_stats = self.client.version()
except Exception as e:
# Correct issue#649
logger.error("{} plugin - Cannot get Docker version ({})".format(self.ext_name, e))
logger.error("{} plugin - Can't get Docker version ({})".format(self.ext_name, e))
return {}, []
# Update current containers list
@ -254,7 +254,7 @@ class DockerContainersExtension:
# The Containers/all key of the configuration file should be set to True
containers = self.client.containers.list(all=all_tag)
except Exception as e:
logger.error("{} plugin - Cannot get containers list ({})".format(self.ext_name, e))
logger.error("{} plugin - Can't get containers list ({})".format(self.ext_name, e))
return version_stats, []
# Start new thread for new container

View File

@ -1,5 +1,4 @@
"""Podman Extension unit for Glances' Containers plugin."""
import json
import time
from datetime import datetime
@ -230,14 +229,14 @@ class PodmanContainersExtension:
try:
self.client = PodmanClient(base_url=self.podman_sock)
except Exception as e:
logger.error("{} plugin - Can not connect to Podman ({})".format(self.ext_name, e))
logger.error("{} plugin - Can't connect to Podman ({})".format(self.ext_name, e))
def update_version(self):
try:
self._version = self.client.version()
self._last_version_update = time.time()
except Exception as e:
logger.error("{} plugin - Cannot get Podman version ({})".format(self.ext_name, e))
logger.error("{} plugin - Can't get Podman version ({})".format(self.ext_name, e))
def stop(self):
# Stop all streaming threads
@ -262,7 +261,7 @@ class PodmanContainersExtension:
if not self.pods_stats_fetcher:
self.pods_stats_fetcher = PodmanPodStatsFetcher(self.client.pods)
except Exception as e:
logger.error("{} plugin - Cannot get containers list ({})".format(self.ext_name, e))
logger.error("{} plugin - Can't get containers list ({})".format(self.ext_name, e))
return self._version, []
# Start new thread for new container