Module: Pacemaker::Nodes
- Included in:
- Puppet::Provider::PacemakerXML, Serverspec::Type::PacemakerXML
- Defined in:
- lib/pacemaker/xml/nodes.rb
Overview
functions related to the cluster nodes main structure “nodes” with node’s names and ids
Instance Method Summary collapse
-
#cib_section_nodes ⇒ REXML::Element
get nodes CIB section.
-
#dc_name ⇒ String?
the name of the current DC node.
-
#node_name ⇒ String
(also: #hostname)
hostname of the current node.
-
#nodes ⇒ Hash<String => Hash>
the nodes structure uname => id.
Instance Method Details
#cib_section_nodes ⇒ REXML::Element
get nodes CIB section
7 8 9 |
# File 'lib/pacemaker/xml/nodes.rb', line 7 def cib_section_nodes REXML::XPath.match cib, '/cib/configuration/nodes/*' end |
#dc_name ⇒ String?
the name of the current DC node
36 37 38 39 40 41 42 43 44 |
# File 'lib/pacemaker/xml/nodes.rb', line 36 def dc_name dc_node_id = dc return unless dc_node_id nodes.each do |node, attrs| next unless attrs['id'] == dc_node_id return node end nil end |
#node_name ⇒ String Also known as: hostname
hostname of the current node
13 14 15 16 |
# File 'lib/pacemaker/xml/nodes.rb', line 13 def node_name return @node_name if @node_name @node_name = crm_node('-n').chomp.strip end |
#nodes ⇒ Hash<String => Hash>
the nodes structure uname => id
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pacemaker/xml/nodes.rb', line 23 def nodes return @nodes_structure if @nodes_structure @nodes_structure = {} cib_section_nodes.each do |node_block| node = attributes_to_hash node_block next unless node['id'] && node['uname'] @nodes_structure.store node['uname'], node end @nodes_structure end |