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
)
This commit is contained in:
parent
8365ed9d86
commit
16ae5e4fca
|
@ -48,6 +48,9 @@ class BaseRunner(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))
|
||||
if not quiet:
|
||||
log.debug(cmd_stdout)
|
||||
log.debug(cmd_stderr)
|
||||
|
@ -270,7 +273,7 @@ class BaseRunner(object):
|
|||
))
|
||||
cmd_stdout, cmd_stderr, returncode = self.execute(cmd, self.log)
|
||||
if returncode != 0:
|
||||
return
|
||||
return []
|
||||
results += cmd_stdout.split("\n")
|
||||
result = []
|
||||
for line in results:
|
||||
|
|
Loading…
Reference in New Issue