Browse Source

Fix return results on cmd failure and error msgs

Return an empty list if container_names fails since that result is used
in a loop for many places.

Add error messages for better observability as well.

Change-Id: Ia79cbf74faa4d8190d2280757403fd2e5b67fbe0
Co-authored-by: Alex Schultz <aschultz@redhat.com>
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit a838a69c4f)
changes/77/728477/1
Bogdan Dobrelya 1 month ago
parent
commit
66487257e7
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      paunch/runner.py

+ 4
- 1
paunch/runner.py View File

@@ -36,6 +36,9 @@ class DockerRunner(object):
subproc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
cmd_stdout, cmd_stderr = subproc.communicate()
if subproc.returncode != 0:
log.error('Error executing %s: returned %s' % (cmd,
subproc.returncode))
log.debug(cmd_stdout)
log.debug(cmd_stderr)
return (cmd_stdout.decode('utf-8'),
@@ -100,7 +103,7 @@ class DockerRunner(object):
))
cmd_stdout, cmd_stderr, returncode = self.execute(cmd, self.log)
if returncode != 0:
return
return []
result = []
for line in cmd_stdout.split("\n"):
if line:


Loading…
Cancel
Save