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

If the peer name in the facts is not the same as in the configuration #257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/facter/gluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
gluster_volumes = {}
peer_count = 0
peer_list = ''
peer_list_ar = []
volume_options = {}
volume_ports = {}

Expand Down Expand Up @@ -50,9 +51,14 @@
gluster_peers[peer]['status'] = peer_xml.elements['stateStr'].text.to_s
end

# Collecting all hostnames of peers
REXML::XPath.match(peer_status_xml, '/cliOutput/peerStatus/peer/hostnames/hostname').each do |hn|
peer_list_ar.append(hn.to_a)
end

# Extract and format the data needed for the legacy peer facts.
peer_count = gluster_peers.size
peer_list = gluster_peers.keys.join(',')
peer_list = peer_list_ar.join(',')

# Get our volume information from gluster volume info
volume_info_xml = REXML::Document.new(Facter::Util::Resolution.exec("#{binary} volume info --xml"))
Expand Down