[modules/docker] Exception when daemon is not running
When the docker daemon is not running, only the call to containers.list() actually throws an exception, so move that into the exception guard. fixes #608
This commit is contained in:
parent
88e56c4c47
commit
a8e01f0df9
1 changed files with 1 additions and 1 deletions
|
@ -33,11 +33,11 @@ class Module(core.module.Module):
|
|||
try:
|
||||
cli = docker.DockerClient(base_url='unix://var/run/docker.sock')
|
||||
cli.ping()
|
||||
self.__info = 'OK - {}'.format(len(cli.containers.list(filters={'status': 'running'})))
|
||||
except ConnectionError:
|
||||
self.__info = 'daemon off'
|
||||
except Exception:
|
||||
self.__info = 'n/a'
|
||||
self.__info = 'OK - {}'.format(len(cli.containers.list(filters={'status': 'running'})))
|
||||
return self.__info
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Reference in a new issue