Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support using the target agent puppet config #3255

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions documentation/applying_manifest_blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ The `apply` function supports the following options:
option is for transports that allow a user to run commands under a different
username.)
- `_agent => true` applies the manifest block with the targets default Puppet
confdir. Without this option, Bolt will use a temporary directory to prevent
Puppet from automatically reading any files from the targets local
configuration.
```puppet
# Preview installing docker as root on $targets.
apply($targets, _catch_errors => true, _noop => true, _run_as => root) {
Expand Down
6 changes: 4 additions & 2 deletions lib/bolt/applicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ 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
message = format("Applying manifest block%s", (" (with agent confdir)" if options[:agent]))
@executor.with_node_logging(message, batch) do
catalog = future.value
if future.rejected?
batch.map do |batch_target|
Expand All @@ -285,7 +286,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
5 changes: 4 additions & 1 deletion libexec/apply_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
puppet_root = Dir.mktmpdir
moduledir = File.join(puppet_root, 'modules')
Dir.mkdir(moduledir)
cli = (Puppet::Settings::REQUIRED_APP_SETTINGS + [:rundir]).flat_map do |setting|
settings = (Puppet::Settings::REQUIRED_APP_SETTINGS + [:rundir]).reject do |setting|
setting == :confdir && args['_agent']
end
cli = settings.flat_map do |setting|
["--#{setting}", File.join(puppet_root, setting.to_s.chomp('dir'))]
end
cli << '--modulepath' << moduledir
Expand Down
Loading