From: Dan Mick Date: Mon, 6 Mar 2017 23:41:36 +0000 (-0800) Subject: downburst: always log output and error, check returncode for failure X-Git-Tag: 1.1.0~450^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e6e50d90cf5be98028134624ae0999e8cdfd67a4;p=teuthology.git downburst: always log output and error, check returncode for failure The more info the better; always log everything about the downburst execution to the teuthology log. Check for command failure by checking for returncode != 0 rather than "presence of stderr", since logging always happens to stderr. Signed-off-by: Dan Mick --- diff --git a/teuthology/provision/downburst.py b/teuthology/provision/downburst.py index 514f38b65..3517a0ee2 100644 --- a/teuthology/provision/downburst.py +++ b/teuthology/provision/downburst.py @@ -73,6 +73,8 @@ class Downburst(object): action="downburst create") as proceed: while proceed(): (returncode, stdout, stderr) = self._run_create() + log.info(stdout) + log.info(stderr) if returncode == 0: log.info("Downburst created %s: %s" % (self.name, stdout.strip())) @@ -136,22 +138,19 @@ class Downburst(object): proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,) out, err = proc.communicate() - if err: + log.info(out) + log.info(err) + if proc.returncode != 0: not_found_msg = "no domain with matching name '%s'" % self.shortname if not_found_msg in err: log.warn("Ignoring error during destroy: %s", err) return True - log.error("Error destroying {machine}: {msg}".format( - machine=self.name, msg=err)) + log.error("Error destroying {machine}: {msg}".format(machine=self.name)) return False - elif proc.returncode == 0: + else: out_str = ': %s' % out if out else '' log.info("Destroyed %s%s" % (self.name, out_str)) return True - else: - log.error("I don't know if the destroy of {node} succeded!".format( - node=self.name)) - return False def build_config(self): """