Skip to content

Commit

Permalink
support using the target agent puppet config
Browse files Browse the repository at this point in the history
modules like puppetlabs-puppetdb which make use of Puppet.runtime[:http]
require the agent ssl certificate and key. this change supports an
optional flag which simply skips the confdir setting override when
initializing the Puppet object.
  • Loading branch information
h0tw1r3 committed Dec 14, 2023
1 parent cdc7b56 commit d3046e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/bolt/applicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def apply_ast(raw_ast, targets, options, plan_vars = {})

result_promises = targets.zip(futures).flat_map do |target, future|
@executor.queue_execute([target]) do |transport, batch|
@executor.with_node_logging("Applying manifest block", batch) do
@executor.with_node_logging("Applying manifest block%s" % (" (with agent confdir)" if options[:agent]), batch) do
catalog = future.value
if future.rejected?
batch.map do |batch_target|
Expand All @@ -285,7 +285,8 @@ def apply_ast(raw_ast, targets, options, plan_vars = {})
'plugins' => Puppet::Pops::Types::PSensitiveType::Sensitive.new(plugins),
'apply_settings' => @apply_settings,
'_task' => catalog_apply_task.name,
'_noop' => options[:noop]
'_noop' => options[:noop],
'_agent' => options[:agent]
}

callback = proc do |event|
Expand Down
6 changes: 3 additions & 3 deletions libexec/apply_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
puppet_root = Dir.mktmpdir
moduledir = File.join(puppet_root, 'modules')
Dir.mkdir(moduledir)
cli = (Puppet::Settings::REQUIRED_APP_SETTINGS + [:rundir]).flat_map do |setting|
["--#{setting}", File.join(puppet_root, setting.to_s.chomp('dir'))]
end
cli = (Puppet::Settings::REQUIRED_APP_SETTINGS + [:rundir]).filter_map do |setting|
["--#{setting}", File.join(puppet_root, setting.to_s.chomp('dir'))] unless (args['_agent'] && setting == :confdir)
end.flatten
cli << '--modulepath' << moduledir
Puppet.initialize_settings(cli)

Expand Down

0 comments on commit d3046e5

Please sign in to comment.