Module: Pacemaker::Properties
- Included in:
- Puppet::Provider::PacemakerXML, Serverspec::Type::PacemakerXML
- Defined in:
- lib/pacemaker/xml/properties.rb
Overview
functions related to the cluster properties main structure “cluster_properties”
Instance Method Summary collapse
-
#cib_section_cluster_property ⇒ REXML::Element
get cluster property CIB section.
-
#cluster_properties ⇒ Hash<String => Hash>
get cluster property structure.
-
#cluster_property_defined?(property_name) ⇒ TrueClass, FalseClass
check if this property has a value.
-
#cluster_property_delete(property_name) ⇒ Object
delete this cluster’s property.
-
#cluster_property_set(property_name, property_value) ⇒ Object
set the value to this cluster’s property.
-
#cluster_property_value(property_name) ⇒ String
get the value of a cluster property by it’s name.
Instance Method Details
#cib_section_cluster_property ⇒ REXML::Element
get cluster property CIB section
7 8 9 |
# File 'lib/pacemaker/xml/properties.rb', line 7 def cib_section_cluster_property REXML::XPath.match(cib, '/cib/configuration/crm_config/cluster_property_set').first end |
#cluster_properties ⇒ Hash<String => Hash>
get cluster property structure
13 14 15 16 |
# File 'lib/pacemaker/xml/properties.rb', line 13 def cluster_properties return @cluster_properties_structure if @cluster_properties_structure @cluster_properties_structure = children_elements_to_hash cib_section_cluster_property, 'name' end |
#cluster_property_defined?(property_name) ⇒ TrueClass, FalseClass
check if this property has a value
46 47 48 49 50 |
# File 'lib/pacemaker/xml/properties.rb', line 46 def cluster_property_defined?(property_name) return false unless cluster_properties.key? property_name return false unless cluster_properties[property_name].is_a?(Hash) && cluster_properties[property_name]['value'] true end |
#cluster_property_delete(property_name) ⇒ Object
delete this cluster’s property
37 38 39 40 41 |
# File 'lib/pacemaker/xml/properties.rb', line 37 def cluster_property_delete(property_name) = ['--quiet', '--type', 'crm_config', '--name', property_name] += ['--delete'] retry_block { crm_attribute_safe } end |
#cluster_property_set(property_name, property_value) ⇒ Object
set the value to this cluster’s property
29 30 31 32 33 |
# File 'lib/pacemaker/xml/properties.rb', line 29 def cluster_property_set(property_name, property_value) = ['--quiet', '--type', 'crm_config', '--name', property_name] += ['--update', property_value] retry_block { crm_attribute_safe } end |
#cluster_property_value(property_name) ⇒ String
get the value of a cluster property by it’s name
21 22 23 24 |
# File 'lib/pacemaker/xml/properties.rb', line 21 def cluster_property_value(property_name) return unless cluster_property_defined? property_name cluster_properties[property_name]['value'] end |