[yocto] [PATCH V2 2/7] DeleteGoogleVMs.py: Initial commit

californialsullivan at gmail.com californialsullivan at gmail.com
Tue Sep 30 10:01:54 PDT 2014


From: California Sullivan <california.l.sullivan at intel.com>

This build step deletes the Google VMs created in the previous ProvisionGoogleVM
build step using Google's gcloud command line tool.

Signed-off-by: California Sullivan <california.l.sullivan at intel.com>
---
 .../autobuilder/buildsteps/DeleteGoogleVMs.py      | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVMs.py

diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVMs.py b/lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVMs.py
new file mode 100644
index 0000000..b0071cf
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVMs.py
@@ -0,0 +1,52 @@
+'''
+Created on Aug 13, 2014
+
+__author__ = "California Sullivan"
+__copyright__ = "Copyright 2014, Intel Corp."
+__credits__ = ["California Sullivan"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Elizabeth Flanagan"
+__email__ = "elizabeth.flanagan at intel.com"
+'''
+
+from buildbot.steps.shell import ShellCommand
+
+class DeleteGoogleVMs(ShellCommand):
+    haltOnFailure = True
+    flunkOnFailure = True
+    name = "Delete Google VMs"
+    def __init__(self, factory, argdict=None, **kwargs):
+
+        self.factory = factory
+        self.description = "Deleting Google VMs"
+        for k, v in argdict.iteritems():
+            if type(v) is bool:
+                setattr(self, k, str(v))
+            else:
+                setattr(self, k, v)
+        # Timeout needs to be passed to LoggingBuildStep as a kwarg
+        self.timeout = 1000
+        kwargs['timeout']=self.timeout
+        ShellCommand.__init__(self, **kwargs)
+
+
+    def start(self):
+        self.vmnames = self.getProperty("vmnames")
+        self.vmcount = self.getProperty("vmcount")
+        self.zone = self.getProperty("zone")
+
+        if self.vmnames is not None and self.vmnames != "":
+            self.command = "gcloud compute instances delete"
+            self.command += " " + self.vmnames
+
+        if self.zone is not None and self.zone in ["us-central1-a", "us-central1-b", "us-central1-f", "europe-west1-a", "europe-west1-b", "asia-east1-a", "asia-east1-b", "asia-east1-b"]:
+            self.command += " --zone " + self.zone
+        else:
+            self.command += " --zone us-central1-a"
+        self.command += " --quiet"
+        ShellCommand.start(self)
+
+    def describe(self, done=False):
+        description = ShellCommand.describe(self,done)
+        return description
-- 
1.9.1




More information about the yocto mailing list