mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-01 14:08:34 +03:00
Manage if Docker-py not found
This commit is contained in:
parent
8afad49287
commit
50f86cb969
@ -61,11 +61,15 @@ class Plugin(GlancesPlugin):
|
||||
def connect(self, version=None):
|
||||
"""Connect to the Docker server"""
|
||||
# Init connection to the Docker API
|
||||
if version is None:
|
||||
ret = docker.Client(base_url='unix://var/run/docker.sock')
|
||||
else:
|
||||
ret = docker.Client(base_url='unix://var/run/docker.sock',
|
||||
version=version)
|
||||
try:
|
||||
if version is None:
|
||||
ret = docker.Client(base_url='unix://var/run/docker.sock')
|
||||
else:
|
||||
ret = docker.Client(base_url='unix://var/run/docker.sock',
|
||||
version=version)
|
||||
except NameError:
|
||||
# docker lib not found
|
||||
return None
|
||||
try:
|
||||
ret.version()
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
|
Loading…
Reference in New Issue
Block a user