Skip to content

Commit

Permalink
Fixes #29455: Allow calling puppet from inside SCL context
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Apr 2, 2020
1 parent 34bc641 commit 473629d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'kafo', '~> 4.0'
gem 'kafo', '~> 4.1'
gem 'librarian-puppet'
gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '~> 6.0'
if RUBY_VERSION < '2.1'
Expand Down
2 changes: 1 addition & 1 deletion hooks/boot/01-kafo-hook-extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def ensure_packages(packages, state = 'installed')

def apply_puppet_code(code)
bin_path = Kafo::PuppetCommand.search_puppet_path('puppet')
Open3.capture3("echo \"#{code}\" | #{bin_path} apply --detailed-exitcodes")
Open3.capture3(*Kafo::PuppetCommand.format_command("echo \"#{code}\" | #{bin_path} apply --detailed-exitcodes"))
end

def fail_and_exit(message, code = 1)
Expand Down
6 changes: 3 additions & 3 deletions spec/hook_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@
end

after do
expect(Kafo::PuppetCommand).to have_received(:search_puppet_path)
expect(Kafo::PuppetCommand).to have_received(:search_puppet_path).twice
end

context 'empty code' do
let(:code) { '' }

specify do
is_expected.to eq('result')
expect(Open3).to have_received(:capture3).with('echo "" | /bin/puppet apply --detailed-exitcodes')
expect(Open3).to have_received(:capture3).with(anything, 'echo "" | /bin/puppet apply --detailed-exitcodes', anything)
end
end

Expand All @@ -137,7 +137,7 @@

specify do
is_expected.to eq('result')
expect(Open3).to have_received(:capture3).with('echo "package { \'vim-enhanced\': ensure => installed }" | /bin/puppet apply --detailed-exitcodes')
expect(Open3).to have_received(:capture3).with(anything, 'echo "package { \'vim-enhanced\': ensure => installed }" | /bin/puppet apply --detailed-exitcodes', anything)
end
end
end
Expand Down

0 comments on commit 473629d

Please sign in to comment.