Add container name in addtion to node IP in docker_check failed o/p

Change-Id: I88a0c3ada509dda32bc2e996b86d2547ff012bfe
This commit is contained in:
Sawan Choudhary 2018-03-08 12:42:08 -08:00
parent b06080b6bf
commit 6ac1ad253d
1 changed files with 9 additions and 4 deletions

View File

@ -220,7 +220,8 @@ class operator_scenario(base.Scenario):
nodeip_list = [node.ip for node in node_list]
anscmd = "ansible -o all -i %s -a " % ','.join(nodeip_list)
cmd = "'docker ps -aq --filter %s '" % "status=exited"
cmd = "'docker ps -a --format \{\{.Names\}\} --filter %s '" \
% "status=exited"
cmd = anscmd + cmd + ' -u root'
res = execute(cmd)
@ -236,7 +237,7 @@ class operator_scenario(base.Scenario):
continue
if 'SUCCESS' not in line[1]:
if docker_failed:
docker_failed = docker_failed + ',' + line[0]
docker_failed = "{}, {}".format(docker_failed, line[0])
else:
docker_failed = line[0]
else:
@ -244,9 +245,13 @@ class operator_scenario(base.Scenario):
line[3] = line[3].replace('(stdout)', '')
if not re.match(r'^\s*$', line[3]):
if docker_failed:
docker_failed = docker_failed + ',' + line[0]
docker_failed = "{}, {}: {}"\
.format(docker_failed,
line[0].strip(),
line[3])
else:
docker_failed = line[0]
docker_failed = "{}: {}".format(line[0].strip(),
line[3])
if docker_failed:
return (404, docker_failed, [])
else: