Last active
December 29, 2020 17:11
-
-
Save towo/ca6460ec856509613986b4cae7e310a9 to your computer and use it in GitHub Desktop.
Looking for a good reason why the Puppet provider decides to remove the start and stop operations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if @property_hash[:existing_resource] == :false || force_reinstall == :true | |
[...] | |
else | |
if @property_hash[:promotable] == :false && @property_hash[:existing_promotable] == :true | |
self.class.run_command_in_cib([command(:pcs), pcs_subcommand, '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), pcs_subcommand, 'op', 'remove', (@property_hash[:name]).to_s] | |
cmd << o.keys.first.to_s | |
o.values.first.each_pair do |k, v| | |
cmd << "#{k}=#{v}" | |
end | |
self.class.run_command_in_cib(cmd, @resource[:cib]) | |
end | |
cmd = [command(:pcs), pcs_subcommand, '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? | |
self.class.run_command_in_cib(cmd, @resource[:cib]) | |
if @property_hash[:promotable] == :true | |
cmd = [command(:pcs), pcs_subcommand, 'update', "ms_#{@property_hash[:name]}"] | |
unless @property_hash[:ms_metadata].empty? && @property_hash[:existing_ms_metadata].empty? | |
cmd << 'meta' | |
@property_hash[:ms_metadata].each_pair do |k, v| | |
cmd << "#{k}=#{v}" | |
end | |
@property_hash[:existing_ms_metadata].keys.reject { |key| @property_hash[:ms_metadata].key?(key) }.each do |k| | |
cmd << "#{k}=" | |
end | |
end | |
self.class.run_command_in_cib(cmd, @resource[:cib]) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Debug: Cs_primitive[duncan_vip](provider=pcs): { | |
:primitive_class=>"ocf", | |
:primitive_type=>"IPaddr2", | |
:provided_by=>"heartbeat", | |
:name=>:duncan_vip, | |
:ensure=>:present, | |
:provider=>:pcs, | |
:parameters=>{ | |
"cidr_netmask"=>"24", | |
"ip"=>"172.16.210.101"}, | |
:operations=>[ | |
{"monitor"=>{"interval"=>"10s"}}, | |
{"start"=>{"interval"=>"0s", "timeout"=>"20s"}}, | |
{"stop"=>{"interval"=>"0s", "timeout"=>"20s"}} | |
], | |
:utilization=>{}, | |
:metadata=>{}, | |
:ms_metadata=>{}, | |
:promotable=>:false, | |
:existing_resource=>:true, | |
:existing_primitive_class=>"ocf", | |
:existing_primitive_type=>"IPaddr2", | |
:existing_promotable=>:false, | |
:existing_provided_by=>"heartbeat", | |
:existing_metadata=>{}, | |
:existing_ms_metadata=>{}, | |
:existing_operations=>[ | |
{"monitor"=>{"interval"=>"10s"}}, | |
{"start"=>{"interval"=>"0s", "timeout"=>"20s"}}, | |
{"stop"=>{"interval"=>"0s", "timeout"=>"20s"}} | |
] | |
} | |
Notice: /Stage[main]/Main/Cs_primitive[duncan_vip]/operations: 2 removed: start (interval=0s timeout=20s) stop (interval=0s timeout=20s) / 1 kept | |
Debug: Puppet::Type::Cs_primitive::ProviderPcs: Executing ["/usr/sbin/pcs", "resource", "op", "remove", "duncan_vip", "start", "interval=0s", "timeout=20s"] in the CIB | |
Debug: Executing: '/usr/sbin/pcs resource op remove duncan_vip start interval=0s timeout=20s' | |
Debug: Puppet::Type::Cs_primitive::ProviderPcs: Executing ["/usr/sbin/pcs", "resource", "op", "remove", "duncan_vip", "stop", "interval=0s", "timeout=20s"] in the CIB | |
Debug: Executing: '/usr/sbin/pcs resource op remove duncan_vip stop interval=0s timeout=20s' | |
Debug: Puppet::Type::Cs_primitive::ProviderPcs: Executing ["/usr/sbin/pcs", "resource", "update", "duncan_vip", "cidr_netmask=24", "ip=172.16.210.101", "op", "monitor", "interval=10s"] in the CIB | |
Debug: Executing: '/usr/sbin/pcs resource update duncan_vip cidr_netmask=24 ip=172.16.210.101 op monitor interval=10s' | |
Debug: /Stage[main]/Main/Cs_primitive[duncan_vip]: The container Class[Main] will propagate my refresh event |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
ops = [ | |
{ 'monitor' => { 'interval' => '10s' } }, | |
{ 'start' => { 'interval' => '0s', 'timeout' => '20s' } }, | |
{ 'stop' => { 'interval' => '0s', 'timeout' => '20s' } } | |
] | |
exops = [ | |
{ 'monitor' => { 'interval' => '10s' } }, | |
{ 'start' => { 'interval' => '0s', 'timeout' => '20s' } }, | |
{ 'stop' => { 'interval' => '0s', 'timeout' => '20s' } } | |
] | |
puts(exops.reject { |op| ops.include?(op) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test.rb
gives no returns, but apparently, the above code sample still pushes the start and stop ops to the removal stack.force_reinstall
is only true if the tuple (primitive_type
,primitive_class
,provided_by
) is a mismatch.