mirror of
https://github.com/odoo/runbot.git
synced 2025-03-16 07:55:45 +07:00
[FIX] avoid docker_ps crash if docker is not installed.
This commit is contained in:
parent
7f4f82a881
commit
702a52464d
@ -140,7 +140,11 @@ def docker_get_gateway_ip():
|
||||
|
||||
def docker_ps():
|
||||
"""Return a list of running containers names"""
|
||||
docker_ps = subprocess.run(['docker', 'ps', '--format', '{{.Names}}'], stderr=subprocess.DEVNULL, stdout=subprocess.PIPE)
|
||||
try:
|
||||
docker_ps = subprocess.run(['docker', 'ps', '--format', '{{.Names}}'], stderr=subprocess.DEVNULL, stdout=subprocess.PIPE)
|
||||
except FileNotFoundError:
|
||||
_logger.warning('Docker not found, returning an empty list.')
|
||||
return []
|
||||
if docker_ps.returncode != 0:
|
||||
return []
|
||||
return docker_ps.stdout.decode().strip().split('\n')
|
||||
|
Loading…
Reference in New Issue
Block a user