From 48a115412580e325fdac15ab02dea4e48532d3ba Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Sun, 13 Oct 2024 11:57:19 +0200 Subject: [PATCH] fix: use chomp instead of chop in test there where instances where a required '>' was chopped off --- lib/puppet/provider/cs_clone/pcs.rb | 2 +- spec/acceptance/cs_location_spec.rb | 4 +++- spec/acceptance/cs_order_spec.rb | 4 +++- spec/unit/puppet/provider/cs_clone_pcs_spec.rb | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/cs_clone/pcs.rb b/lib/puppet/provider/cs_clone/pcs.rb index 814f5d21..81d153d0 100644 --- a/lib/puppet/provider/cs_clone/pcs.rb +++ b/lib/puppet/provider/cs_clone/pcs.rb @@ -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 diff --git a/spec/acceptance/cs_location_spec.rb b/spec/acceptance/cs_location_spec.rb index 80f4a7c8..4665e9e5 100755 --- a/spec/acceptance/cs_location_spec.rb +++ b/spec/acceptance/cs_location_spec.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# rubocop:disable Style/FrozenStringLiteralComment require 'spec_helper_acceptance' @@ -243,3 +243,5 @@ class { 'corosync': end end end + +# rubocop:enable Style/FrozenStringLiteralComment diff --git a/spec/acceptance/cs_order_spec.rb b/spec/acceptance/cs_order_spec.rb index f008f800..ad69242c 100644 --- a/spec/acceptance/cs_order_spec.rb +++ b/spec/acceptance/cs_order_spec.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# rubocop:disable Style/FrozenStringLiteralComment require 'spec_helper_acceptance' @@ -173,3 +173,5 @@ class { 'corosync': end end end + +# rubocop:enable Style/FrozenStringLiteralComment diff --git a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb index f4782389..290c8f9e 100644 --- a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb @@ -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)