From: Zack Cerza Date: Mon, 6 Mar 2017 19:35:27 +0000 (+0000) Subject: provision.downburst: Tweak destroy return code X-Git-Tag: 1.1.0~451^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1040%2Fhead;p=teuthology.git provision.downburst: Tweak destroy return code Specifically, if the instance doesn't even exist, consider the destroy op to have succeeded. Signed-off-by: Zack Cerza --- diff --git a/teuthology/provision/downburst.py b/teuthology/provision/downburst.py index d9e300a9..b973c6f0 100644 --- a/teuthology/provision/downburst.py +++ b/teuthology/provision/downburst.py @@ -44,6 +44,7 @@ class Downburst(object): """ def __init__(self, name, os_type, os_version, status=None, user='ubuntu'): self.name = name + self.shortname = decanonicalize_hostname(self.name) self.os_type = os_type self.os_version = os_version self.status = status or query.get_status(self.name) @@ -98,7 +99,6 @@ class Downburst(object): raise ValueError("I need a config_path!") if not self.user_path: raise ValueError("I need a user_path!") - shortname = decanonicalize_hostname(self.name) args = [ self.executable, @@ -107,7 +107,7 @@ class Downburst(object): '--wait', '--meta-data=%s' % self.config_path, '--user-data=%s' % self.user_path, - shortname, + self.shortname, ] log.info("Provisioning a {distro} {distroversion} vps".format( distro=self.os_type, @@ -126,12 +126,15 @@ class Downburst(object): if not executable: log.error("No downburst executable found.") return False - shortname = decanonicalize_hostname(self.name) - args = [executable, '-c', self.host, 'destroy', shortname] + args = [executable, '-c', self.host, 'destroy', self.shortname] proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,) out, err = proc.communicate() if err: + 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)) return False @@ -257,4 +260,4 @@ def get_distro_from_downburst(): except (subprocess.CalledProcessError, OSError): log.exception("Error calling downburst!") log.info('Using default values for supported os_type/os_version') - return default_table \ No newline at end of file + return default_table