Only db-sync sahara is included in the bootstrapnode
authorJuan Antonio Osorio Robles <jaosorior@redhat.com>
Tue, 9 Aug 2016 07:27:15 +0000 (10:27 +0300)
committerJuan Antonio Osorio Robles <jaosorior@redhat.com>
Tue, 9 Aug 2016 13:42:06 +0000 (16:42 +0300)
Currently, sahara's db-sync is run on every node. We should instead
run it if we're on the bootstrap node as race conditions may occur
and these will cause issues.

Change-Id: I5db281caae17402ff198cb4cd46304338d98c52e

manifests/profile/base/sahara.pp
manifests/profile/base/sahara/api.pp
manifests/profile/base/sahara/engine.pp

index befb5d3..96d23a6 100644 (file)
 #
 # === Parameters
 #
+# [*bootstrap_node*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
 # [*step*]
 #   (Optional) The current step of the deployment
 #   Defaults to hiera('step')
 #
 class tripleo::profile::base::sahara (
-  $step = hiera('step'),
+  $bootstrap_node = hiera('bootstrap_nodeid', undef),
+  $step           = hiera('step'),
 ) {
-  if $step >= 4 {
-    include ::sahara
+  if $::hostname == downcase($bootstrap_node) {
+    $sync_db = true
+  } else {
+    $sync_db = false
+  }
+
+  if $step >= 4 or ($step >= 3 and $sync_db){
+    class { '::sahara':
+      sync_db => $sync_db,
+    }
   }
 }
index dc23d64..27e0390 100644 (file)
@@ -26,8 +26,9 @@
 class tripleo::profile::base::sahara::api (
   $step                    = hiera('step'),
 ) {
+  include ::tripleo::profile::base::sahara
+
   if $step >= 4 {
-    include ::tripleo::profile::base::sahara
     include ::sahara::service::api
   }
 }
index f792a96..2d41e75 100644 (file)
@@ -37,12 +37,13 @@ class tripleo::profile::base::sahara::engine (
     $sync_db = false
   }
 
+  include ::tripleo::profile::base::sahara
+
   if $step >= 3 and $sync_db {
     include ::sahara::db::mysql
   }
 
   if $step >= 4 or ($step >= 3 and $sync_db) {
-    include ::tripleo::profile::base::sahara
     include ::sahara::service::engine
   }
 }