Catch devops error if inspecting containers goes wrong
In case something is wrong with inspecting containers catch DevopsError instead of failing whole deployment Change-Id: Ib4888c30c6b1dcae8d6094f769246fac6b41e164
This commit is contained in:
parent
e1d0e06d99
commit
27e62c6f13
|
@ -16,6 +16,7 @@ import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from devops.helpers import helpers
|
from devops.helpers import helpers
|
||||||
|
from devops.error import DevopsError
|
||||||
|
|
||||||
from fuel_ccp_tests import logger
|
from fuel_ccp_tests import logger
|
||||||
|
|
||||||
|
@ -75,15 +76,19 @@ def inspect_docker_containers(image_name, underlay, host_ip):
|
||||||
if result:
|
if result:
|
||||||
LOG.info("Inspecting running containers with name={name}: on: {node}".
|
LOG.info("Inspecting running containers with name={name}: on: {node}".
|
||||||
format(name=image_name, node=host_ip))
|
format(name=image_name, node=host_ip))
|
||||||
for container in result.stdout_json:
|
try:
|
||||||
raw_out = container['Config']['Labels']
|
for container in result.stdout_json:
|
||||||
labels = json.dumps(
|
raw_out = container['Config']['Labels']
|
||||||
raw_out,
|
labels = json.dumps(
|
||||||
indent=4,
|
raw_out,
|
||||||
separators=(',', ': '),
|
indent=4,
|
||||||
sort_keys=True
|
separators=(',', ': '),
|
||||||
)
|
sort_keys=True
|
||||||
LOG.info("Docker container {name} Labels: {labels}".format(
|
)
|
||||||
name=container['Name'],
|
LOG.info("Docker container {name} Labels: {labels}".format(
|
||||||
labels=labels)
|
name=container['Name'],
|
||||||
)
|
labels=labels)
|
||||||
|
)
|
||||||
|
except DevopsError:
|
||||||
|
LOG.info("{} stdout is not a valid json. Stdout:{}".format(
|
||||||
|
cmd, result.stdout))
|
||||||
|
|
Loading…
Reference in New Issue