]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Refactor to extract get_mon_nodes() utility function.
authorTommi Virtanen <tv@inktank.com>
Wed, 25 Jul 2012 21:26:19 +0000 (14:26 -0700)
committerTommi Virtanen <tv@inktank.com>
Wed, 25 Jul 2012 22:19:19 +0000 (15:19 -0700)
libraries/default.rb

index e640fff0462dcb15d714b128ab9c5e76261278ab..59bc8bdb77f0f6f39ff9c9f916a154fc83ec6b5e 100644 (file)
@@ -2,16 +2,9 @@ def is_crowbar?()
   return defined?(Chef::Recipe::Barclamp) != nil
 end
 
-def get_mon_addresses()
+def get_mon_nodes()
   mons = []
 
-  # make sure if this node runs ceph-mon, it's always included even if
-  # search is laggy; put it first in the hopes that clients will talk
-  # primarily to local node
-  if node['roles'].include? 'ceph-mon'
-    mons << node
-  end
-
   if is_crowbar?
     mon_roles = search(:role, 'name:crowbar-* AND run_list:role\[ceph-mon\]')
     if not mon_roles.empty?
@@ -21,6 +14,20 @@ def get_mon_addresses()
   else
     mons += search(:node, "role:ceph-mon AND chef_environment:#{node.chef_environment}")
   end
+  return mons
+end
+
+def get_mon_addresses()
+  mons = []
+
+  # make sure if this node runs ceph-mon, it's always included even if
+  # search is laggy; put it first in the hopes that clients will talk
+  # primarily to local node
+  if node['roles'].include? 'ceph-mon'
+    mons << node
+  end
+
+  mons += get_mon_nodes()
 
   if is_crowbar?
     mon_addresses = mons.map { |node| Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address }