Check that nova compute minion exists before running states
Change-Id: Ic2b3f9b9ac757334b4b0aeeaacadf9799c93a137
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index 67b4298..5ec8a78 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -346,8 +346,10 @@
def installOpenstackCompute(master) {
def salt = new com.mirantis.mk.Salt()
// Configure compute nodes
- retry(2) {
- salt.enforceHighstateWithExclude(master, 'I@nova:compute', 'opencontrail.client')
+ if (salt.testTarget(master, 'I@nova:compute')) {
+ retry(2) {
+ salt.enforceHighstateWithExclude(master, 'I@nova:compute', 'opencontrail.client')
+ }
}
}
@@ -381,9 +383,13 @@
// Provision opencontrail virtual routers
// Generate script /usr/lib/contrail/if-vhost0 for up vhost0
- salt.enforceStateWithExclude(master, "I@opencontrail:compute", "opencontrail", "opencontrail.client")
+ if (salt.testTarget(master, 'I@opencontrail:compute')) {
+ salt.enforceStateWithExclude(master, "I@opencontrail:compute", "opencontrail", "opencontrail.client")
+ }
- salt.cmdRun(master, 'I@nova:compute', 'exec 0>&-; exec 1>&-; exec 2>&-; nohup bash -c "ip link | grep vhost && echo no_reboot || sleep 5 && reboot & "', false)
+ if (salt.testTarget(master, 'I@nova:compute')) {
+ salt.cmdRun(master, 'I@nova:compute', 'exec 0>&-; exec 1>&-; exec 2>&-; nohup bash -c "ip link | grep vhost && echo no_reboot || sleep 5 && reboot & "', false)
+ }
if (salt.testTarget(master, 'I@opencontrail:compute')) {
sleep(300)