update switchq to calling provisioner, fixed a few bugs found while testing at on.labs

Change-Id: I2367669aa54f680b98ff0cbbc8d41a49fb7e7a79
diff --git a/build.gradle b/build.gradle
index 3f515a6..9f10b41 100644
--- a/build.gradle
+++ b/build.gradle
@@ -32,6 +32,24 @@
     vboxUser = project.hasProperty('vboxUser') ? project.getProperty('vboxUser') : 'cord'
 }
 
+// Switch Configuration Image
+
+task buildSwitchqImage(type: Exec) {
+    commandLine "$dockerPath/docker", 'build', '-t', 'cord-maas-switchq', './switchq'
+}
+
+task tagSwitchqImage(type: Exec) {
+   dependsOn buildSwitchqImage
+   commandLine "$dockerPath/docker", 'tag', 'cord-maas-switchq', "$targetReg/cord-maas-switchq:$targetTag"
+}
+
+task publishSwitchqImage(type: Exec) {
+    dependsOn tagSwitchqImage
+    commandLine "$dockerPath/docker", 'push', "$targetReg/cord-maas-switchq:$targetTag"
+}
+
+// Bootstrap Image
+
 task buildBootstrapImage(type: Exec) {
     commandLine "$dockerPath/docker", 'build', '-t', 'cord-maas-bootstrap', './bootstrap'
 }
@@ -46,6 +64,8 @@
     commandLine "$dockerPath/docker", 'push', "$targetReg/cord-maas-bootstrap:$targetTag"
 }
 
+// IP Allocator Image
+
 task buildAllocationImage(type: Exec) {
     commandLine "$dockerPath/docker", 'build', '-t', 'cord-ip-allocator', './ip-allocator'
 }
@@ -60,6 +80,8 @@
     commandLine "$dockerPath/docker", 'push', "$targetReg/cord-ip-allocator:$targetTag"
 }
 
+// Provisioner Image
+
 task buildProvisionerImage(type: Exec) {
     commandLine "$dockerPath/docker", 'build', '-t', 'cord-provisioner', './provisioner'
 }
@@ -74,6 +96,8 @@
     commandLine "$dockerPath/docker", 'push', "$targetReg/cord-provisioner:$targetTag"
 }
 
+// Automation Images
+
 task buildAutomationImage(type: Exec) {
     commandLine "$dockerPath/docker", 'build', '-t', "cord-maas-automation", "-f", "./automation/Dockerfile", "./automation"
 }
@@ -117,18 +141,20 @@
     dependsOn publishAutomationImageAnsible
 }
 
+// DHCP Harvester Images
+
 task buildHarvesterImage(type: Exec) {
-    commandLine "$dockerPath/docker", 'build', '-t', "cord-maas-dhcp-harvester", "./harvester"
+    commandLine "$dockerPath/docker", 'build', '-t', "cord-dhcp-harvester", "./harvester"
 }
 
 task tagHarvesterImage(type: Exec) {
     dependsOn buildHarvesterImage
-    commandLine "$dockerPath/docker", 'tag', 'cord-maas-dhcp-harvester', "$targetReg/cord-maas-dhcp-harvester:$targetTag"
+    commandLine "$dockerPath/docker", 'tag', 'cord-dhcp-harvester', "$targetReg/cord-dhcp-harvester:$targetTag"
 }
 
 task publishHarvesterImage(type: Exec) {
     dependsOn tagHarvesterImage
-    commandLine "$dockerPath/docker", 'push', "$targetReg/cord-maas-dhcp-harvester:$targetTag"
+    commandLine "$dockerPath/docker", 'push', "$targetReg/cord-dhcp-harvester:$targetTag"
 }
 
 // ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
@@ -149,6 +175,7 @@
     dependsOn buildAutomationImages
     dependsOn buildAllocationImage
     dependsOn buildProvisionerImage
+    dependsOn buildSwitchqImage
 }
 
 task tagImages {
@@ -157,6 +184,7 @@
     dependsOn tagAutomationImages
     dependsOn tagAllocationImage
     dependsOn tagProvisionerImage
+    dependsOn tagSwitchqImage
 }
 
 task publish {
@@ -165,6 +193,7 @@
     dependsOn publishAutomationImages
     dependsOn publishAllocationImage
     dependsOn publishProvisionerImage
+    dependsOn publishSwitchqImage
 }
 
 // ~~~~~~~~~~~~~~~~~~~ Deployment / Test Tasks  ~~~~~~~~~~~~~~~~~~~~~~~
@@ -231,6 +260,11 @@
         .p(config.otherServers.role, "prov_role")
     }
 
+    if (config.docker) {
+        extraVars = extraVars.p(config.docker.registry, "docker_registry")
+            .p(config.docker.imageVersion, "docker_image_version")
+    }
+
     def skipTags = [].p(config.seedServer.skipTags)
 
     args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "head-node.yml"