Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved constant QUORUM_STATES into function. #185

Merged
merged 1 commit into from
Jan 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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