diff --git a/lib/puppet/provider/cs_clone/crm.rb b/lib/puppet/provider/cs_clone/crm.rb index 763c85ab..deaac50f 100644 --- a/lib/puppet/provider/cs_clone/crm.rb +++ b/lib/puppet/provider/cs_clone/crm.rb @@ -23,7 +23,7 @@ def self.instances instances = [] cmd = [command(:crm), 'configure', 'show', 'xml'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//resources//clone') do |e| @@ -75,9 +75,9 @@ def create def destroy debug('Removing clone') cmd = [command(:crm), '-w', 'resource', 'stop', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib], false) + self.class.run_command_in_cib(cmd, @resource[:cib], false) cmd = [command(:crm), 'configure', 'delete', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -115,7 +115,7 @@ def flush tmpfile.write(updated) tmpfile.flush cmd = [command(:crm), 'configure', 'load', 'update', tmpfile.path.to_s] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource.value(:cib)) + self.class.run_command_in_cib(cmd, @resource.value(:cib)) end end end diff --git a/lib/puppet/provider/cs_clone/pcs.rb b/lib/puppet/provider/cs_clone/pcs.rb index caf9561b..d0e5cb63 100644 --- a/lib/puppet/provider/cs_clone/pcs.rb +++ b/lib/puppet/provider/cs_clone/pcs.rb @@ -20,13 +20,13 @@ def change_clone_id(type, primitive, id, cib) xpath = "/cib/configuration/resources/clone[descendant::#{type}[@id='#{primitive}']]" cmd = [command(:cibadmin), '--query', '--xpath', xpath] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, cib) + raw, = self.class.run_command_in_cib(cmd, cib) doc = REXML::Document.new(raw) return unless doc.root.attributes['id'] != id doc.root.attributes['id'] = id cmd = [command(:cibadmin), '--replace', '--xpath', xpath, '--xml-text', doc.to_s.chop] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, cib) + self.class.run_command_in_cib(cmd, cib) end def self.instances @@ -35,7 +35,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//resources//clone') do |e| @@ -89,7 +89,7 @@ def create # Unlike create we actually immediately delete the item. def destroy debug 'Removing clone' - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'unclone', @resource[:name]], @resource[:cib]) + self.class.run_command_in_cib([command(:pcs), 'resource', 'unclone', @resource[:name]], @resource[:cib]) @property_hash.clear end @@ -116,7 +116,7 @@ def flush # pcs versions earlier than 0.9.116 do not allow updating a cloned # resource. Being conservative, we will unclone then create a new clone # with the new parameters. - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'unclone', @property_hash[:existing_clone_element]], @resource.value(:cib)) + self.class.run_command_in_cib([command(:pcs), 'resource', 'unclone', @property_hash[:existing_clone_element]], @resource.value(:cib)) end cmd = [command(:pcs), 'resource', 'clone', target.to_s] { @@ -129,7 +129,7 @@ def flush }.each do |property, clone_property| cmd << "#{clone_property}=#{@resource.should(property)}" unless @resource.should(property) == :absent end - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource.value(:cib)) + self.class.run_command_in_cib(cmd, @resource.value(:cib)) change_clone_id(target_type, target, @resource.value(:name), @resource.value(:cib)) end end diff --git a/lib/puppet/provider/cs_colocation/crm.rb b/lib/puppet/provider/cs_colocation/crm.rb index df0051ba..5e257a8a 100644 --- a/lib/puppet/provider/cs_colocation/crm.rb +++ b/lib/puppet/provider/cs_colocation/crm.rb @@ -104,7 +104,7 @@ def create def destroy debug('Removing colocation') cmd = [command(:crm), 'configure', 'delete', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -153,7 +153,7 @@ def flush Tempfile.open('puppet_crm_update') do |tmpfile| tmpfile.write(updated) tmpfile.flush - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(['crm', 'configure', 'load', 'update', tmpfile.path.to_s], @resource[:cib]) + self.class.run_command_in_cib(['crm', 'configure', 'load', 'update', tmpfile.path.to_s], @resource[:cib]) end end end diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 4901e0d9..dfc281e9 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -23,7 +23,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) resource_set_options = ['sequential', 'require-all', 'action', 'role'] @@ -102,7 +102,7 @@ def create def destroy debug('Removing colocation') cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -153,7 +153,7 @@ def flush if @property_hash[:new] == false debug('Removing colocation') cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end first_item = @property_hash[:primitives].shift cmd = [command(:pcs), 'constraint', 'colocation'] @@ -196,6 +196,6 @@ def flush cmd << @property_hash[:score] cmd << "id=#{@property_hash[:name]}" end - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end diff --git a/lib/puppet/provider/cs_commit/crm.rb b/lib/puppet/provider/cs_commit/crm.rb index 91a15bdd..580460a2 100644 --- a/lib/puppet/provider/cs_commit/crm.rb +++ b/lib/puppet/provider/cs_commit/crm.rb @@ -19,11 +19,11 @@ def self.instances end def commit - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(['crm_shadow', '--force', '--commit', @resource[:name]]) + self.class.run_command_in_cib(['crm_shadow', '--force', '--commit', @resource[:name]]) # We run the next command in the CIB directly by purpose: # We commit the shadow CIB with the admin_epoch it was created. - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(['cibadmin', '--modify', '--xml-text', '']) + self.class.run_command_in_cib(['cibadmin', '--modify', '--xml-text', '']) # Next line is for indempotency - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.sync_shadow_cib(@resource[:name], true) + self.class.sync_shadow_cib(@resource[:name], true) end end diff --git a/lib/puppet/provider/cs_commit/pcs.rb b/lib/puppet/provider/cs_commit/pcs.rb index f8414d8e..c7c368c1 100644 --- a/lib/puppet/provider/cs_commit/pcs.rb +++ b/lib/puppet/provider/cs_commit/pcs.rb @@ -19,11 +19,11 @@ def self.instances def commit cib_path = File.join(Puppet[:vardir], 'shadow.' + @resource[:name]) - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'cluster', 'cib-push', cib_path, 'diff-against=' + cib_path + '.ori']) + self.class.run_command_in_cib([command(:pcs), 'cluster', 'cib-push', cib_path, 'diff-against=' + cib_path + '.ori']) # We run the next command in the CIB directly by purpose: # We commit the shadow CIB with the admin_epoch it was created. - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:cibadmin), '--modify', '--xml-text', '']) + self.class.run_command_in_cib([command(:cibadmin), '--modify', '--xml-text', '']) # Next line is for indempotency - PuppetX::Voxpupuli::Corosync::Provider::Pcs.sync_shadow_cib(@resource[:name], true) + self.class.sync_shadow_cib(@resource[:name], true) end end diff --git a/lib/puppet/provider/cs_group/crm.rb b/lib/puppet/provider/cs_group/crm.rb index 0dcbb6c2..58183475 100644 --- a/lib/puppet/provider/cs_group/crm.rb +++ b/lib/puppet/provider/cs_group/crm.rb @@ -19,7 +19,7 @@ def self.instances instances = [] cmd = [command(:crm), 'configure', 'show', 'xml'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//group') do |e| @@ -58,10 +58,10 @@ def create def destroy debug('Stopping group before removing it') cmd = [command(:crm), '-w', 'resource', 'stop', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib], false) + self.class.run_command_in_cib(cmd, @resource[:cib], false) debug('Removing group') cmd = [command(:crm), 'configure', 'delete', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -93,7 +93,7 @@ def flush tmpfile.write(updated) tmpfile.flush cmd = [command(:crm), 'configure', 'load', 'update', tmpfile.path.to_s] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end end diff --git a/lib/puppet/provider/cs_group/pcs.rb b/lib/puppet/provider/cs_group/pcs.rb index 595af6d1..a1a8a197 100644 --- a/lib/puppet/provider/cs_group/pcs.rb +++ b/lib/puppet/provider/cs_group/pcs.rb @@ -21,7 +21,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//group') do |e| @@ -61,7 +61,7 @@ def create # we need to stop the group. def destroy debug('Removing group') - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'ungroup', @property_hash[:name]], @resource[:cib]) + self.class.run_command_in_cib([command(:pcs), 'resource', 'ungroup', @property_hash[:name]], @resource[:cib]) @property_hash.clear end @@ -88,11 +88,11 @@ def flush if @property_hash[:new] == false debug('Removing group') - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'ungroup', @property_hash[:name]], @resource[:cib]) + self.class.run_command_in_cib([command(:pcs), 'resource', 'ungroup', @property_hash[:name]], @resource[:cib]) end cmd = [command(:pcs), 'resource', 'group', 'add', (@property_hash[:name]).to_s] cmd += @property_hash[:primitives] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index 10df85ca..bc0da485 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -33,7 +33,7 @@ def self.instances # The expression key is handled differently because the result must not # contain the id of the XML node. The crm command can not set the # expression id so Puppet would try to update the rule at every run. - id, items = PuppetX::Voxpupuli::Corosync::Provider::CibHelper.node2hash(e, ['expression']).first + id, items = self.class.node2hash(e, ['expression']).first location_instance = { name: id, @@ -67,7 +67,7 @@ def create # Unlike create we actually immediately delete the item. def destroy debug('Removing location') - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(['crm', 'configure', 'delete', @resource[:name]], @resource[:cib]) + self.class.run_command_in_cib(['crm', 'configure', 'delete', @resource[:name]], @resource[:cib]) @property_hash.clear end @@ -108,7 +108,7 @@ def flush Tempfile.open('puppet_crm_update') do |tmpfile| tmpfile.write(updated) tmpfile.flush - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(['crm', 'configure', 'load', 'update', tmpfile.path.to_s], @resource[:cib]) + self.class.run_command_in_cib(['crm', 'configure', 'load', 'update', tmpfile.path.to_s], @resource[:cib]) end end end diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index c29e40d2..1d9bbf5c 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -26,7 +26,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) constraints = doc.root.elements['configuration'].elements['constraints'] @@ -36,7 +36,7 @@ def self.instances # The expression key is handled differently because the result must # not contain the id of the XML node. The crm command can not set the # expression id so Puppet would try to update the rule at every run. - id, items = PuppetX::Voxpupuli::Corosync::Provider::CibHelper.node2hash(e, ['expression']).first + id, items = self.class.node2hash(e, ['expression']).first location_instance = { name: id, @@ -72,7 +72,7 @@ def create def destroy debug('Removing location') cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -85,11 +85,11 @@ def flush # Remove existing location cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib], false) + self.class.run_command_in_cib(cmd, @resource[:cib], false) unless @property_hash[:node_name].nil? cmd = [command(:pcs), 'constraint', 'location', 'add', @property_hash[:name], @property_hash[:primitive], @property_hash[:node_name], @property_hash[:score]] cmd << "resource-discovery=#{@property_hash[:resource_discovery]}" unless @property_hash[:resource_discovery].nil? - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end return if @property_hash[:rules].nil? @@ -116,7 +116,7 @@ def flush else [command(:pcs), 'constraint', 'rule', 'add', @resource[:name]] + params end - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd_rule, @resource[:cib]) + self.class.run_command_in_cib(cmd_rule, @resource[:cib]) count += 1 end end diff --git a/lib/puppet/provider/cs_order/crm.rb b/lib/puppet/provider/cs_order/crm.rb index 712722d5..937c05c7 100644 --- a/lib/puppet/provider/cs_order/crm.rb +++ b/lib/puppet/provider/cs_order/crm.rb @@ -24,7 +24,7 @@ def self.instances instances = [] cmd = [command(:crm), 'configure', 'show', 'xml'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) doc.root.elements['configuration'].elements['constraints'].each_element('rsc_order') do |e| @@ -81,7 +81,7 @@ def create # Unlike create we actually immediately delete the item. def destroy debug('Removing order directive') - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib([command(:crm), 'configure', 'delete', @resource[:name]], @resource[:cib]) + self.class.run_command_in_cib([command(:crm), 'configure', 'delete', @resource[:name]], @resource[:cib]) @property_hash.clear end @@ -100,7 +100,7 @@ def flush Tempfile.open('puppet_crm_update') do |tmpfile| tmpfile.write(updated) tmpfile.flush - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib([command(:crm), 'configure', 'load', 'update', tmpfile.path.to_s], @resource[:cib]) + self.class.run_command_in_cib([command(:crm), 'configure', 'load', 'update', tmpfile.path.to_s], @resource[:cib]) end end end diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index 904301dd..f17559ff 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -28,7 +28,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) constraints = doc.root.elements['configuration'].elements['constraints'] @@ -101,7 +101,7 @@ def create def destroy debug('Removing order directive') cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -115,7 +115,7 @@ def flush if @property_hash[:new] == false debug('Removing order directive') cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end cmd = [command(:pcs), 'constraint', 'order'] @@ -130,6 +130,6 @@ def flush cmd << "kind=#{@property_hash[:kind]}" cmd << "id=#{@property_hash[:name]}" cmd << "symmetrical=#{@property_hash[:symmetrical]}" - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index 6d940834..cc641e5a 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -75,7 +75,7 @@ def self.instances instances = [] cmd = [command(:crm), 'configure', 'show', 'xml'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//primitive') do |e| @@ -108,10 +108,10 @@ def create def destroy debug('Stopping primitive before removing it') cmd = [command(:crm), 'resource', 'stop', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) debug('Removing primitive') cmd = [command(:crm), 'configure', 'delete', @resource[:name]] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -172,9 +172,9 @@ def promotable=(should) when :false @property_hash[:promotable] = should cmd = [command(:crm), 'resource', 'stop', "ms_#{@resource[:name]}"] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) cmd = [command(:crm), 'configure', 'delete', "ms_#{@resource[:name]}"] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end @@ -248,7 +248,7 @@ def flush tmpfile.write(updated) tmpfile.flush cmd = ['crm', '-F', 'configure', 'load', 'update', tmpfile.path.to_s] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end end diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 0bda7520..c230ca63 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -87,7 +87,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//primitive') do |e| @@ -121,7 +121,7 @@ def create # Unlike create we actually immediately delete the item. def destroy debug('Removing primitive') - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'delete', '--force', @resource[:name]], @resource[:cib]) + self.class.run_command_in_cib([command(:pcs), 'resource', 'delete', '--force', @resource[:name]], @resource[:cib]) @property_hash.clear end @@ -131,7 +131,7 @@ def promotable=(should) @property_hash[:promotable] = should when :false @property_hash[:promotable] = should - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'delete', "ms_#{@resource[:name]}"], @resource[:cib]) + self.class.run_command_in_cib([command(:pcs), 'resource', 'delete', "ms_#{@resource[:name]}"], @resource[:cib]) end end @@ -205,8 +205,8 @@ def flush existing_ressource_type << (@property_hash[:existing_primitive_type]).to_s if existing_ressource_type != ressource_type debug('Removing primitive') - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'unclone', (@property_hash[:name]).to_s], @resource[:cib], false) - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'delete', '--force', (@property_hash[:name]).to_s], @resource[:cib]) + self.class.run_command_in_cib([command(:pcs), 'resource', 'unclone', (@property_hash[:name]).to_s], @resource[:cib], false) + self.class.run_command_in_cib([command(:pcs), 'resource', 'delete', '--force', (@property_hash[:name]).to_s], @resource[:cib]) force_reinstall = :true end end @@ -222,7 +222,7 @@ def flush cmd += operations unless operations.nil? cmd += utilization unless utilization.nil? cmd += metadatas unless metadatas.nil? - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) # if we are using a master/slave resource, prepend ms_ before its name # and declare it as a master/slave resource if @property_hash[:promotable] == :true @@ -233,17 +233,17 @@ def flush cmd << "#{k}=#{v}" end end - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end # try to remove the default monitor operation default_op = { 'monitor' => { 'interval' => '60s' } } unless @property_hash[:operations].include?(default_op) cmd = [command(:pcs), 'resource', 'op', 'remove', (@property_hash[:name]).to_s, 'monitor', 'interval=60s'] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib], false) + self.class.run_command_in_cib(cmd, @resource[:cib], false) end else if @property_hash[:promotable] == :false && @property_hash[:existing_promotable] == :true - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib([command(:pcs), 'resource', 'delete', '--force', "ms_#{@property_hash[:name]}"], @resource[:cib]) + self.class.run_command_in_cib([command(:pcs), 'resource', 'delete', '--force', "ms_#{@property_hash[:name]}"], @resource[:cib]) end @property_hash[:existing_operations].reject { |op| @property_hash[:operations].include?(op) }.each do |o| cmd = [command(:pcs), 'resource', 'op', 'remove', (@property_hash[:name]).to_s] @@ -251,14 +251,14 @@ def flush o.values.first.each_pair do |k, v| cmd << "#{k}=#{v}" end - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end cmd = [command(:pcs), 'resource', 'update', (@property_hash[:name]).to_s] cmd += parameters unless parameters.nil? cmd += operations unless operations.nil? cmd += utilization unless utilization.nil? cmd += metadatas unless metadatas.nil? - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) if @property_hash[:promotable] == :true cmd = [command(:pcs), 'resource', 'update', "ms_#{@property_hash[:name]}", (@property_hash[:name]).to_s] unless @property_hash[:ms_metadata].empty? && @property_hash[:existing_ms_metadata].empty? @@ -270,7 +270,7 @@ def flush cmd << "#{k}=" end end - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end end diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index aea6feb3..e16169c8 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -22,7 +22,7 @@ def self.instances instances = [] cmd = [command(:crm), 'configure', 'show', 'xml'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] @@ -85,6 +85,6 @@ def flush # clear this on properties, in case it's set from a previous # run of a different corosync type cmd = [command(:crm), 'configure', 'property', '$id="cib-bootstrap-options"', "#{@property_hash[:name]}=#{@property_hash[:value]}"] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index 3884fa68..b9b31bee 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -23,7 +23,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] @@ -58,7 +58,7 @@ def create def destroy debug('Removing cluster property') cmd = [command(:pcs), 'property', 'unset', (@property_hash[:name]).to_s] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -86,6 +86,6 @@ def flush # clear this on properties, in case it's set from a previous # run of a different corosync type cmd = [command(:pcs), 'property', 'set', "#{@property_hash[:name]}=#{@property_hash[:value]}"] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end diff --git a/lib/puppet/provider/cs_rsc_defaults/crm.rb b/lib/puppet/provider/cs_rsc_defaults/crm.rb index 6c67bee9..1350528b 100644 --- a/lib/puppet/provider/cs_rsc_defaults/crm.rb +++ b/lib/puppet/provider/cs_rsc_defaults/crm.rb @@ -22,7 +22,7 @@ def self.instances instances = [] cmd = [command(:crm), 'configure', 'show', 'xml'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//configuration/rsc_defaults/meta_attributes/nvpair') do |e| @@ -81,6 +81,6 @@ def flush # clear this on properties, in case it's set from a previous # run of a different corosync type cmd = [command(:crm), 'configure', 'rsc_defaults', '$id="rsc-options"', "#{@property_hash[:name]}=#{@property_hash[:value]}"] - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end diff --git a/lib/puppet/provider/cs_rsc_defaults/pcs.rb b/lib/puppet/provider/cs_rsc_defaults/pcs.rb index 9204e592..9c1a85be 100644 --- a/lib/puppet/provider/cs_rsc_defaults/pcs.rb +++ b/lib/puppet/provider/cs_rsc_defaults/pcs.rb @@ -23,7 +23,7 @@ def self.instances instances = [] cmd = [command(:pcs), 'cluster', 'cib'] - raw, = PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd) + raw, = self.class.run_command_in_cib(cmd) doc = REXML::Document.new(raw) REXML::XPath.each(doc, '//configuration/rsc_defaults/meta_attributes/nvpair') do |e| @@ -55,7 +55,7 @@ def create def destroy debug('Removing resource default') cmd = [command(:pcs), 'resource', 'defaults', (@property_hash[:name]).to_s + '='] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end @@ -82,6 +82,6 @@ def flush # clear this on properties, in case it's set from a previous # run of a different corosync type cmd = [command(:pcs), 'resource', 'defaults', "#{@property_hash[:name]}=#{@property_hash[:value]}"] - PuppetX::Voxpupuli::Corosync::Provider::Pcs.run_command_in_cib(cmd, @resource[:cib]) + self.class.run_command_in_cib(cmd, @resource[:cib]) end end diff --git a/lib/puppet/provider/cs_shadow/crm.rb b/lib/puppet/provider/cs_shadow/crm.rb index 40450c5a..0559d40e 100644 --- a/lib/puppet/provider/cs_shadow/crm.rb +++ b/lib/puppet/provider/cs_shadow/crm.rb @@ -19,7 +19,7 @@ def self.instances # Need this available at the provider level, for types def get_epoch(cib = nil) - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.get_epoch(cib) + self.class.get_epoch(cib) end def epoch @@ -31,6 +31,6 @@ def insync?(cib) end def sync(_cib) - PuppetX::Voxpupuli::Corosync::Provider::Crmsh.sync_shadow_cib(@resource[:name]) + self.class.sync_shadow_cib(@resource[:name]) end end diff --git a/lib/puppet/provider/cs_shadow/pcs.rb b/lib/puppet/provider/cs_shadow/pcs.rb index 41d4096c..78e80b74 100644 --- a/lib/puppet/provider/cs_shadow/pcs.rb +++ b/lib/puppet/provider/cs_shadow/pcs.rb @@ -19,7 +19,7 @@ def self.instances # Need this available at the provider level, for types def get_epoch(cib = nil) - PuppetX::Voxpupuli::Corosync::Provider::Pcs.get_epoch(cib) + self.class.get_epoch(cib) end def epoch @@ -31,6 +31,6 @@ def insync?(cib) end def sync(_cib) - PuppetX::Voxpupuli::Corosync::Provider::Pcs.sync_shadow_cib(@resource[:name]) + self.class.sync_shadow_cib(@resource[:name]) end end