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 puppet config #3256

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions lib/bolt/config/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ module Options
"plan function or the `bolt apply` command.",
type: Hash,
properties: {
"confdir" => {
description: "This feature is experimental. Use the bolt created temporary path "\
"or the Puppet default confdir on the target.",
type: String,
enum: %w[bolt target],
_example: "target",
_default: "bolt"
},
"evaltrace" => {
description: "Whether each resource should log when it is being evaluated. This allows "\
"you to interactively see exactly what is being done.",
Expand Down
13 changes: 12 additions & 1 deletion libexec/apply_catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
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'))]
if setting == :confdir && args['apply_settings']['confdir'] == 'target'
# skip isolating confdir and override basemodulepath
# as we never want to load agent modules
['--basemodulepath', Puppet.default_basemodulepath]
else
["--#{setting}", File.join(puppet_root, setting.to_s.chomp('dir'))]
end
end
cli << '--modulepath' << moduledir
Puppet.initialize_settings(cli)
Expand All @@ -28,6 +34,11 @@

# Make sure to apply the catalog
Puppet[:noop] = args['_noop'] || false

# delete because its not an actual path
# and can't be changed after initialization
delete(args['apply_settings']['confdir'])

args['apply_settings'].each do |setting, value|
Puppet[setting.to_sym] = value
end
Expand Down
8 changes: 8 additions & 0 deletions schemas/bolt-project.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@
"description": "A map of Puppet settings to use when applying Puppet code using the `apply` plan function or the `bolt apply` command.",
"type": "object",
"properties": {
"confdir": {
"description": "This feature is experimental. Use the bolt created temporary path or the Puppet default confdir on the target.",
"type": "string",
"enum": [
"bolt",
"target"
]
},
"evaltrace": {
"description": "Whether each resource should log when it is being evaluated. This allows you to interactively see exactly what is being done.",
"type": "boolean"
Expand Down
Loading