[modules/docker_ps] quotes

This commit is contained in:
tobi-wan-kenobi 2020-04-13 13:31:48 +02:00
parent 15ae56d2ee
commit e270ec55ef

View file

@ -33,10 +33,10 @@ class Module(bumblebee.engine.Module):
def state(self, widget): def state(self, widget):
state = [] state = []
status = self.status(widget) status = self.status(widget)
if status == "OK - 0": if status == 'OK - 0':
state.append("warning") state.append('warning')
elif status in ["n/a", "Daemon off"]: elif status in ['n/a', 'Daemon off']:
state.append("critical") state.append('critical')
return state return state
def status(self, widget): def status(self, widget):
@ -44,7 +44,7 @@ class Module(bumblebee.engine.Module):
cli = docker.DockerClient(base_url='unix://var/run/docker.sock') cli = docker.DockerClient(base_url='unix://var/run/docker.sock')
cli.ping() cli.ping()
except ConnectionError: except ConnectionError:
return "Daemon off" return 'Daemon off'
except Exception: except Exception:
return "n/a" return 'n/a'
return "OK - {}".format(len(cli.containers.list(filters={'status': "running"}))) return 'OK - {}'.format(len(cli.containers.list(filters={'status': 'running'})))