Skip to content

Commit

Permalink
fix: use chomp instead of chop
Browse files Browse the repository at this point in the history
in test there  where instances where a required '>' was chopped off
  • Loading branch information
TheMeier committed Oct 13, 2024
1 parent 1ac4ad1 commit 48a1154
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/cs_clone/pcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def change_clone_id(type, primitive, id, cib)
return unless doc.root.attributes['id'] != id

doc.root.attributes['id'] = id
cmd = [command(:cibadmin), '--replace', '--xpath', xpath, '--xml-text', doc.to_s.chop]
cmd = [command(:cibadmin), '--replace', '--xpath', xpath, '--xml-text', doc.to_s.chomp]
self.class.run_command_in_cib(cmd, cib)
end

Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/cs_location_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# rubocop:disable Style/FrozenStringLiteralComment

require 'spec_helper_acceptance'

Expand Down Expand Up @@ -243,3 +243,5 @@ class { 'corosync':
end
end
end

# rubocop:enable Style/FrozenStringLiteralComment
4 changes: 3 additions & 1 deletion spec/acceptance/cs_order_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# rubocop:disable Style/FrozenStringLiteralComment

require 'spec_helper_acceptance'

Expand Down Expand Up @@ -173,3 +173,5 @@ class { 'corosync':
end
end
end

# rubocop:enable Style/FrozenStringLiteralComment
2 changes: 1 addition & 1 deletion spec/unit/puppet/provider/cs_clone_pcs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def clone_xml(name)
Puppet::Util::Execution.expects(:execute).with(['cibadmin', '--query', '--xpath', xpath], failonfail: true, combine: true).at_least_once.returns(
Puppet::Util::Execution::ProcessOutput.new(clone_xml('apache_service-clone'), 0)
)
Puppet::Util::Execution.expects(:execute).with(['cibadmin', '--replace', '--xpath', xpath, '--xml-text', clone_xml('apache_service-newclone').chop], failonfail: true, combine: true).at_least_once.returns(
Puppet::Util::Execution.expects(:execute).with(['cibadmin', '--replace', '--xpath', xpath, '--xml-text', clone_xml('apache_service-newclone').chomp], failonfail: true, combine: true).at_least_once.returns(
Puppet::Util::Execution::ProcessOutput.new('', 0)
)
instance.change_clone_id('primitive', 'apache_service', 'apache_service-newclone', nil)
Expand Down

0 comments on commit 48a1154

Please sign in to comment.