Class: Serverspec::Type::Pacemaker_resource
- Inherits:
-
PacemakerXML
- Object
- Base
- PacemakerXML
- Serverspec::Type::Pacemaker_resource
- Defined in:
- lib/serverspec/type/pacemaker_resource.rb
Overview
This Serverspec type can do the check on the Pacemaker resource object
Instance Method Summary collapse
-
#clone? ⇒ true, ...
Check if this resource is clone nil if not exists.
-
#complex? ⇒ true, ...
Check if this resource is complex nil if not exists.
-
#complex_meta_attributes ⇒ Hash?
(also: #complex_metadata)
The hash of complex resource related metadata values.
-
#complex_type ⇒ String?
Is this resource complex or simple? (master, clone, simple).
-
#failed? ⇒ true, ...
Check if this resource have been failed nil if not exists.
-
#full_name ⇒ String
The full name of the resource It will have a prefix is the resource is complex.
-
#group? ⇒ true, ...
Check if this resource is in group nil if not exists.
-
#group_name ⇒ String?
Get the name of the resource group if this resource belongs to one nil if not exists.
-
#has_location_on?(node) ⇒ true, ...
check if the resource has the service location on this node.
-
#instance ⇒ Hash?
The data object from the library or nil if there is no object.
-
#instance_attributes ⇒ Hash?
(also: #parameters)
The hash of instance attribute (configuration parameters).
-
#managed? ⇒ true, ...
Check if this resource have Pacemaker management enabled nil if not exists.
-
#master? ⇒ true, ...
(also: #multi_state?)
Check if this resource is master nil if not exists.
-
#master_running? ⇒ true, ...
Check if this resource is running is the master mode nil if not exists.
-
#meta_attributes ⇒ Hash?
(also: #metadata)
The hash of this resource’s meta attributes (i.e. resource-stickiness).
-
#operations ⇒ Array<Hash>
The array of this resource operations.
-
#present? ⇒ true, false
(also: #exists?)
Check if this object is present.
-
#res_class ⇒ String?
The base class of this resource (i.e. ocf, lsb).
-
#res_provider ⇒ String?
The provider of this resource (i.e. heartbeat, pacemaker).
-
#res_type ⇒ String?
The actual resource type (i.e. Dummy, IPaddr).
-
#running? ⇒ true, ...
Check if this resource is currently running nil if not exists.
-
#simple? ⇒ true, ...
Check if this resource is simple nil if not exists.
-
#started? ⇒ true, ...
Check if this resource has Started target state It doesn’t mean that it’s actually running, and constraints may prevent it from being run at all.
-
#status(node = nil) ⇒ String?
Get the current actual status of the resource.
-
#to_s ⇒ Object
Test representation.
Methods inherited from PacemakerXML
Methods included from Pacemaker::Type
#add_to_operations_array, #compare_meta_attributes, #compare_operations, #inspect_to_s, #insync_debug, #munge_meta_attributes, #munge_operation, #munge_operations_array, #munge_rule, #primitive_base_name, #stringify_data
Methods included from Pacemaker::Xml
#xml_document, #xml_element, #xml_pretty_format
Methods included from Pacemaker::Wait
#online?, #retry_block, #wait_for_constraint_create, #wait_for_constraint_remove, #wait_for_constraint_update, #wait_for_master, #wait_for_online, #wait_for_primitive_create, #wait_for_primitive_remove, #wait_for_primitive_update, #wait_for_start, #wait_for_status, #wait_for_stop
Methods included from Pacemaker::Status
#cib_section_lrm_resources, #cib_section_lrm_rsc_ops, #cib_section_node_state, #decode_lrm_resources, #decode_lrm_rsc_ops, #determine_primitive_status, #failed_operations_found?, #node_status, #operation_status, #primitive_has_failures?, #primitive_has_master_running?, #primitive_has_status_on, #primitive_is_running?, #primitive_status, #primitives_status_by_node
Methods included from Pacemaker::OperationDefault
#cib_section_operation_defaults, #operation_default_defined?, #operation_default_delete, #operation_default_set, #operation_default_value, #operation_defaults
Methods included from Pacemaker::ResourceDefault
#cib_section_resource_defaults, #resource_default_defined?, #resource_default_delete, #resource_default_set, #resource_default_value, #resource_defaults
Methods included from Pacemaker::Debug
#cibadmin_safe, #cluster_debug_report, #cmapctl_safe, #crm_attribute_safe, #crm_node_safe, #crm_resource_safe, #debug_mode_enabled?, #resource_operations_report, #safe_method
Methods included from Pacemaker::Properties
#cib_section_cluster_property, #cluster_properties, #cluster_property_defined?, #cluster_property_delete, #cluster_property_set, #cluster_property_value
Methods included from Pacemaker::Primitives
#ban_primitive, #cib_section_primitives, #cleanup_primitive, #disable_primitive, #enable_primitive, #manage_primitive, #move_primitive, #parse_operations, #primitive_class, #primitive_complex_type, #primitive_exists?, #primitive_full_name, #primitive_group, #primitive_in_group?, #primitive_is_clone?, #primitive_is_complex?, #primitive_is_managed?, #primitive_is_master?, #primitive_is_simple?, #primitive_is_started?, #primitive_provider, #primitive_type, #primitives, #read_complex_types, #set_primitive_meta_attribute, #unban_primitive, #unmanage_primitive, #unmove_primitive, #write_complex_types, #xml_primitive
Methods included from Pacemaker::Options
#max_wait_time, pacemaker_options, #pacemaker_options, pacemaker_options_file
Methods included from Pacemaker::Nodes
#cib_section_nodes, #dc_name, #node_name, #nodes
Methods included from Pacemaker::Helpers
#attributes_to_hash, #children_elements_to_array, #children_elements_to_hash, #copy_value, #export_attributes_structure, #get_primitive_puppet_enable, #get_primitive_puppet_status, #import_attributes_structure, #sort_data
Methods included from Pacemaker::ConstraintColocations
#constraint_colocation_add, #constraint_colocation_exists?, #constraint_colocation_remove, #constraint_colocations, #xml_rsc_colocation
Methods included from Pacemaker::ConstraintLocations
#constraint_location_add, #constraint_location_exists?, #constraint_location_remove, #constraint_locations, #service_location_add, #service_location_exists?, #service_location_name, #service_location_remove, #xml_rsc_location
Methods included from Pacemaker::ConstraintOrders
#constraint_order_add, #constraint_order_exists?, #constraint_order_remove, #constraint_orders, #xml_rsc_order
Methods included from Pacemaker::Constraints
#cib_section_constraint_rules, #cib_section_constraints, #constraint_exists?, #constraints, #decode_constraint, #decode_constraint_rules
Methods included from Pacemaker::Cib
#cib, #cib=, #cib?, #cib_reset, #cibadmin_create, #cibadmin_delete, #cibadmin_modify, #cibadmin_replace, #dc, #dc_version, #raw_cib
Instance Method Details
#clone? ⇒ true, ...
Check if this resource is clone nil if not exists
97 98 99 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 97 def clone? primitive_is_clone? @name end |
#complex? ⇒ true, ...
Check if this resource is complex nil if not exists
83 84 85 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 83 def complex? primitive_is_complex? @name end |
#complex_meta_attributes ⇒ Hash? Also known as: complex_metadata
The hash of complex resource related metadata values
73 74 75 76 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 73 def return unless instance import_attributes_structure instance.fetch('complex', {}).fetch('meta_attributes', nil) end |
#complex_type ⇒ String?
Is this resource complex or simple? (master, clone, simple)
65 66 67 68 69 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 65 def complex_type complex_type = primitive_complex_type @name complex_type = complex_type.to_s if complex_type.is_a? Symbol complex_type end |
#failed? ⇒ true, ...
Check if this resource have been failed nil if not exists
158 159 160 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 158 def failed? primitive_has_failures? @name end |
#full_name ⇒ String
The full name of the resource It will have a prefix is the resource is complex
15 16 17 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 15 def full_name primitive_full_name @name end |
#group? ⇒ true, ...
Check if this resource is in group nil if not exists
113 114 115 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 113 def group? primitive_in_group? @name end |
#group_name ⇒ String?
Get the name of the resource group if this resource belongs to one nil if not exists
121 122 123 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 121 def group_name primitive_group @name end |
#has_location_on?(node) ⇒ true, ...
check if the resource has the service location on this node
172 173 174 175 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 172 def has_location_on?(node) return unless exists? service_location_exists? full_name, node end |
#instance ⇒ Hash?
The data object from the library or nil if there is no object
23 24 25 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 23 def instance primitives[@name] end |
#instance_attributes ⇒ Hash? Also known as: parameters
The hash of instance attribute (configuration parameters)
47 48 49 50 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 47 def instance_attributes return unless instance import_attributes_structure instance['instance_attributes'] end |
#managed? ⇒ true, ...
Check if this resource have Pacemaker management enabled nil if not exists
128 129 130 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 128 def managed? primitive_is_managed? @name end |
#master? ⇒ true, ... Also known as: multi_state?
Check if this resource is master nil if not exists
104 105 106 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 104 def master? primitive_is_master? @name end |
#master_running? ⇒ true, ...
Check if this resource is running is the master mode nil if not exists
165 166 167 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 165 def master_running? primitive_has_master_running? @name end |
#meta_attributes ⇒ Hash? Also known as: metadata
The hash of this resource’s meta attributes (i.e. resource-stickiness)
56 57 58 59 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 56 def return unless instance import_attributes_structure instance['meta_attributes'] end |
#operations ⇒ Array<Hash>
The array of this resource operations
179 180 181 182 183 184 185 186 187 188 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 179 def operations return unless instance return unless instance['operations'] operations_data = [] sort_data(instance['operations']).each do |operation| operation.delete 'id' operations_data << operation end operations_data end |
#present? ⇒ true, false Also known as: exists?
Check if this object is present
8 9 10 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 8 def present? primitive_exists? @name end |
#res_class ⇒ String?
The base class of this resource (i.e. ocf, lsb)
29 30 31 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 29 def res_class primitive_class @name end |
#res_provider ⇒ String?
The provider of this resource (i.e. heartbeat, pacemaker)
35 36 37 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 35 def res_provider primitive_provider @name end |
#res_type ⇒ String?
The actual resource type (i.e. Dummy, IPaddr)
41 42 43 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 41 def res_type primitive_type @name end |
#running? ⇒ true, ...
Check if this resource is currently running nil if not exists
151 152 153 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 151 def running? primitive_is_running? @name end |
#simple? ⇒ true, ...
Check if this resource is simple nil if not exists
90 91 92 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 90 def simple? primitive_is_simple? @name end |
#started? ⇒ true, ...
Check if this resource has Started target state It doesn’t mean that it’s actually running, and constraints may prevent it from being run at all. nil if not exists
137 138 139 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 137 def started? primitive_is_started? @name end |
#status(node = nil) ⇒ String?
Get the current actual status of the resource. It can be start, stop, master and nil(unknown)
144 145 146 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 144 def status(node=nil) primitive_status @name, node end |
#to_s ⇒ Object
Test representation
191 192 193 |
# File 'lib/serverspec/type/pacemaker_resource.rb', line 191 def to_s "Pacemaker_resource #{@name}" end |