Skip to content

Commit

Permalink
Merge pull request #185 from elliott-davis/master
Browse files Browse the repository at this point in the history
Moved constant QUORUM_STATES into function.
  • Loading branch information
guilhem committed Jan 13, 2015
2 parents 0a31f64 + 19ec076 commit 4e1fcec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 4e1fcec

Please sign in to comment.