Skip to content

Commit

Permalink
RuboCop appeasement
Browse files Browse the repository at this point in the history
  • Loading branch information
towo committed Dec 16, 2021
1 parent 1b5e11e commit b838f9d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions lib/puppet/provider/cs_primitive/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def promotable=(should)
when :false
@property_hash[:promotable] = should
if Gem::Version.new(self.class.version) >= Gem::Version.new('0.10.0')
self.class.run_command_in_cib([command(:pcs), 'resource', 'delete', "#{@resource[:name]}"]-clone, @resource[:cib])
self.class.run_command_in_cib([command(:pcs), 'resource', 'delete', @resource[:name].to_s] - clone, @resource[:cib])
else
self.class.run_command_in_cib([command(:pcs), 'resource', 'delete', "ms_#{@resource[:name]}"], @resource[:cib])
end
Expand Down Expand Up @@ -243,11 +243,11 @@ def _flush_resource(operations, parameters, utilization, metadatas)
# if we are using a multistate/promotable resource, prepend ms_ before its name
# and declare it as a multistate/promotable resource
if @property_hash[:promotable] == :true
if Gem::Version.new(self.class.version) >= Gem::Version.new('0.10.0')
cmd = [command(:pcs), pcs_subcommand, 'promotable', (@property_hash[:name]).to_s]
else
cmd = [command(:pcs), pcs_subcommand, 'master', "ms_#{@property_hash[:name]}", (@property_hash[:name]).to_s]
end
cmd = if Gem::Version.new(self.class.version) >= Gem::Version.new('0.10.0')
[command(:pcs), pcs_subcommand, 'promotable', (@property_hash[:name]).to_s]
else
[command(:pcs), pcs_subcommand, 'master', "ms_#{@property_hash[:name]}", (@property_hash[:name]).to_s]
end
unless @property_hash[:ms_metadata].empty?
cmd << 'meta'
@property_hash[:ms_metadata].each_pair do |k, v|
Expand Down Expand Up @@ -285,11 +285,11 @@ def _flush_resource(operations, parameters, utilization, metadatas)
cmd += metadatas unless metadatas.nil?
self.class.run_command_in_cib(cmd, @resource[:cib])
if @property_hash[:promotable] == :true
if Gem::Version.new(self.class.version) >= Gem::Version.new('0.10.0')
cmd = [command(:pcs), pcs_subcommand, 'update', "#{@property_hash[:name]}-clone"]
else
cmd = [command(:pcs), pcs_subcommand, 'update', "ms_#{@property_hash[:name]}"]
end
cmd = if Gem::Version.new(self.class.version) >= Gem::Version.new('0.10.0')
[command(:pcs), pcs_subcommand, 'update', "#{@property_hash[:name]}-clone"]
else
[command(:pcs), pcs_subcommand, 'update', "ms_#{@property_hash[:name]}"]
end
unless @property_hash[:ms_metadata].empty? && @property_hash[:existing_ms_metadata].empty?
cmd << 'meta'
@property_hash[:ms_metadata].each_pair do |k, v|
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/cs_primitive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'promotable'
end
else
'master'
'master'
end
it 'with defaults' do
pp = <<-EOS
Expand Down
10 changes: 5 additions & 5 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
case fact_on(host, 'os.family')
when 'RedHat'
default_provider = 'pcs'
if fact_on(host, 'os.release.major').to_i > 7
pcs_version = '0.10.0'
else
pcs_version = '0.9.0'
end
pcs_version = if fact_on(host, 'os.release.major').to_i > 7
'0.10.0'
else
'0.9.0'
end
when 'Debian'
case fact_on(host, 'os.name')
when 'Debian'
Expand Down

0 comments on commit b838f9d

Please sign in to comment.