]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Moved constant QUORUM_STATES into function. 185/head
authorElliott Davis <elliott@excellent.io>
Tue, 13 Jan 2015 14:06:07 +0000 (08:06 -0600)
committerElliott Davis <elliott@excellent.io>
Tue, 13 Jan 2015 17:36:45 +0000 (11:36 -0600)
This variable being a global makes chefspec lose it's mind.
Updated to remove constant in favor of local variable in function

libraries/default.rb

index ce15d6ded4fa10ced6a1e0a66586e7887d75d6e2..29b3ca6f04d26f0acb2a2d338a64ff17d476913a 100644 (file)
@@ -149,7 +149,6 @@ def quorum_members_ips
   mon_ips
 end
 
-QUORUM_STATES = %w(leader, peon)
 def quorum?
   # "ceph auth get-or-create-key" would hang if the monitor wasn't
   # in quorum yet, which is highly likely on the first run. This
@@ -160,13 +159,14 @@ def quorum?
   # in the ceph tool, this exits immediately if the ceph-mon is not
   # running for any reason; trying to connect via TCP/IP would wait
   # for a relatively long timeout.
+  quorum_states = %w(leader, peon)
 
   cmd = Mixlib::ShellOut.new("ceph --admin-daemon /var/run/ceph/ceph-mon.#{node['hostname']}.asok mon_status")
   cmd.run_command
   cmd.error!
 
   state = JSON.parse(cmd.stdout)['state']
-  QUORUM_STATES.include?(state)
+  quorum_states.include?(state)
 end
 
 # Cephx is on by default, but users can disable it.