From: California Sullivan <california.l.sulli...@intel.com>

In the case that somebody turned off a build before it completed, the
buildstep would attempt and fail to procure a new VM, failing the build.

Signed-off-by: California Sullivan <california.l.sulli...@intel.com>
---
 .../autobuilder/buildsteps/ProvisionGoogleVMs.py         | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py 
b/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py
index d0bc6eb..262526f 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/ProvisionGoogleVMs.py
@@ -19,6 +19,7 @@ class ProvisionGoogleVMs(ShellCommand):
     name = "Provision Google VMs"
     def __init__(self, factory, argdict=None, **kwargs):
         self.vmname=None
+        self.vmnames=""
         self.vmcount=1
         self.startupscript=None
         self.metadata=None
@@ -38,15 +39,18 @@ class ProvisionGoogleVMs(ShellCommand):
         if self.vmname is None or self.vmname == "":
             self.finished(FAILURE)
         else:
-            self.command = "gcloud compute instances create"
-            self.vmnames = ""
+            self.command = ""
+            if self.zone is None or self.zone not 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.zone = "us-central1-a"
             for x in range(0, self.vmcount):
                 self.vmnames += " " + self.vmname + "-" + str(x)
+            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 += " --zone " + self.zone + " --quiet;"
+            self.command += " gcloud compute instances create"
+            self.command += self.vmnames
+            self.command += " --zone " + self.zone
+
             if self.disksize is not None and self.disksize != "":
                 self.command += " --boot-disk-size " + self.disksize
             else:
-- 
1.9.3

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to