Handle galera_node_names being an array
authorJiri Stransky <jistr@redhat.com>
Mon, 29 Aug 2016 11:50:12 +0000 (13:50 +0200)
committerJiri Stransky <jistr@redhat.com>
Mon, 29 Aug 2016 12:58:57 +0000 (14:58 +0200)
Prepare the pacemaker mysql manifest that galera_node_names will be an
array. Stay backwards compatible to handle comma-delimited-string too
and avoid a chicken-and-egg patch problem between t-h-t and
puppet-tripleo.

Change-Id: Ia0d9d59728c8771974bfbc486f4929b99a38e4fb
Partially-Implements: blueprint custom-roles

manifests/profile/pacemaker/database/mysql.pp

index 31d7d80..bec955c 100644 (file)
@@ -32,8 +32,17 @@ class tripleo::profile::pacemaker::database::mysql (
     $pacemaker_master = false
   }
   $mysql_bind_host = hiera('mysql_bind_host')
-  $galera_nodes = downcase(hiera('galera_node_names', $::hostname))
+
+  # use only mysql_node_names when we land a patch in t-h-t that
+  # switches to autogenerating these values from composable services
+  $galera_node_names_lookup = hiera('mysql_node_names', hiera('galera_node_names', $::hostname))
+  if is_array($galera_node_names_lookup) {
+    $galera_nodes = downcase(join($galera_node_names_lookup, ','))
+  } else {
+    $galera_nodes = downcase($galera_node_names_lookup)
+  }
   $galera_nodes_count = count(split($galera_nodes, ','))
+
   $mysqld_options = {
     'mysqld' => {
       'skip-name-resolve'             => '1',