From: California Sullivan <california.l.sulli...@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.sulli...@intel.com> --- .../autobuilder/buildsteps/DeleteGoogleVM.py | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVM.py diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVM.py b/lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVM.py new file mode 100644 index 0000000..29b45a4 --- /dev/null +++ b/lib/python2.7/site-packages/autobuilder/buildsteps/DeleteGoogleVM.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.flana...@intel.com" +''' + +from buildbot.steps.shell import ShellCommand + +class DeleteGoogleVM(ShellCommand): + haltOnFailure = True + flunkOnFailure = True + name = "Delete Google VM" + 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 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto