diff options
author | Alessio Sergi <al3hex@gmail.com> | 2015-09-20 19:49:49 +0200 |
---|---|---|
committer | Alessio Sergi <al3hex@gmail.com> | 2015-09-20 19:49:49 +0200 |
commit | b75d921ff01311780cb1b54c0151ac1b18c0c603 (patch) | |
tree | 25a02534be732d3bc231dc342fd7c63a25d71bfb | |
parent | 40c4b7ac234cc5a23198c6ce6b60cde7e5ea44a1 (diff) |
Use Python 2.6 compatible string.format calls (take 2)
-rw-r--r-- | glances/plugins/glances_docker.py | 12 | ||||
-rw-r--r-- | glances/plugins/glances_ip.py | 2 | ||||
-rw-r--r-- | glances/plugins/glances_plugin.py | 2 | ||||
-rw-r--r-- | glances/plugins/glances_processlist.py | 2 | ||||
-rw-r--r-- | glances/plugins/glances_quicklook.py | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py index 09599b6a..f1d3eda0 100644 --- a/glances/plugins/glances_docker.py +++ b/glances/plugins/glances_docker.py @@ -175,7 +175,7 @@ class Plugin(GlancesPlugin): self.stats['version'] = self.docker_client.version() except Exception as e: # Correct issue#649 - logger.error("{} plugin - Can not get Docker version ({})".format(self.plugin_name, e)) + logger.error("{0} plugin - Cannot get Docker version ({1})".format(self.plugin_name, e)) return self.stats # Container globals information @@ -192,7 +192,7 @@ class Plugin(GlancesPlugin): try: self.stats['containers'] = self.docker_client.containers() or [] except Exception as e: - logger.error("{} plugin - Can not get containers list ({})".format(self.plugin_name, e)) + logger.error("{0} plugin - Cannot get containers list ({1})".format(self.plugin_name, e)) return self.stats # Start new thread for new container @@ -200,7 +200,7 @@ class Plugin(GlancesPlugin): if container['Id'] not in self.thread_list: # Thread did not exist in the internal dict # Create it and add it to the internal dict - logger.debug("{} plugin - Create thread for container {}".format(self.plugin_name, container['Id'][:12])) + logger.debug("{0} plugin - Create thread for container {1}".format(self.plugin_name, container['Id'][:12])) t = ThreadDockerGrabber(self.docker_client, container['Id']) self.thread_list[container['Id']] = t t.start() @@ -209,7 +209,7 @@ class Plugin(GlancesPlugin): nonexisting_containers = list(set(self.thread_list.keys()) - set([c['Id'] for c in self.stats['containers']])) for container_id in nonexisting_containers: # Stop the thread - logger.debug("{} plugin - Stop thread for old container {}".format(self.plugin_name, container_id[:12])) + logger.debug("{0} plugin - Stop thread for old container {1}".format(self.plugin_name, container_id[:12])) self.thread_list[container_id].stop() # Delete the item from the dict del(self.thread_list[container_id]) @@ -536,7 +536,7 @@ class ThreadDockerGrabber(threading.Thread): """Init the class: docker_client: instance of Docker-py client container_id: Id of the container""" - logger.debug("docker plugin - Create thread for container {}".format(container_id[:12])) + logger.debug("docker plugin - Create thread for container {0}".format(container_id[:12])) super(ThreadDockerGrabber, self).__init__() # Event needed to stop properly the thread self._stopper = threading.Event() @@ -565,7 +565,7 @@ class ThreadDockerGrabber(threading.Thread): self._stats = value def stop(self, timeout=None): - logger.debug("docker plugin - Close thread for container {}".format(self._container_id[:12])) + logger.debug("docker plugin - Close thread for container {0}".format(self._container_id[:12])) self._stopper.set() def stopped(self): diff --git a/glances/plugins/glances_ip.py b/glances/plugins/glances_ip.py index 1190a2dd..4dac50a3 100644 --- a/glances/plugins/glances_ip.py +++ b/glances/plugins/glances_ip.py @@ -71,7 +71,7 @@ class Plugin(GlancesPlugin): try: default_gw = netifaces.gateways()['default'][netifaces.AF_INET] except (KeyError, AttributeError) as e: - logger.debug("Can not grab the default gateway ({})".format(e)) + logger.debug("Cannot grab the default gateway ({0})".format(e)) else: try: self.stats['address'] = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['addr'] diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 5380e1b8..d768103a 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -73,7 +73,7 @@ class GlancesPlugin(object): def exit(self): """Method to be called when Glances exit""" - logger.debug("Stop the {} plugin".format(self.plugin_name)) + logger.debug("Stop the {0} plugin".format(self.plugin_name)) def __repr__(self): """Return the raw stats.""" diff --git a/glances/plugins/glances_processlist.py b/glances/plugins/glances_processlist.py index a08479c1..f619de6d 100644 --- a/glances/plugins/glances_processlist.py +++ b/glances/plugins/glances_processlist.py @@ -256,7 +256,7 @@ class Plugin(GlancesPlugin): # See https://github.com/nicolargo/glances/issues/87 # Also catch TypeError on Mac OS X # See: https://github.com/nicolargo/glances/issues/622 - logger.debug("Can not get TIME+ ({})".format(e)) + logger.debug("Cannot get TIME+ ({0})".format(e)) self.tag_proc_time = False else: hours, minutes, seconds, microseconds = convert_timedelta(delta) diff --git a/glances/plugins/glances_quicklook.py b/glances/plugins/glances_quicklook.py index 794face1..fd93d053 100644 --- a/glances/plugins/glances_quicklook.py +++ b/glances/plugins/glances_quicklook.py @@ -122,7 +122,7 @@ class Plugin(GlancesPlugin): try: bar.percent = cpu['total'] except AssertionError: - logger.error("Quicklook: {} percent error 0 < {} > 100".format(key, cpu['total'])) + logger.error("Quicklook: {0} percent error 0 < {1} > 100".format(key, cpu['total'])) continue if cpu[cpu['key']] < 10: msg = '{0:3}{1} '.format(key.upper(), cpu['cpu_number']) @@ -138,7 +138,7 @@ class Plugin(GlancesPlugin): try: bar.percent = self.stats[key] except AssertionError: - logger.error("Quicklook: {} percent error 0 < {} > 100".format(key, self.stats[key])) + logger.error("Quicklook: {0} percent error 0 < {1} > 100".format(key, self.stats[key])) continue msg = '{0:4} '.format(key.upper()) ret.append(self.curse_add_line(msg)) |