diff --git a/lib/bolt/config/options.rb b/lib/bolt/config/options.rb index 6a6ec53d54..50783e225c 100644 --- a/lib/bolt/config/options.rb +++ b/lib/bolt/config/options.rb @@ -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.", diff --git a/libexec/apply_catalog.rb b/libexec/apply_catalog.rb index ccf6d62232..52c8bec730 100755 --- a/libexec/apply_catalog.rb +++ b/libexec/apply_catalog.rb @@ -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) @@ -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 diff --git a/schemas/bolt-project.schema.json b/schemas/bolt-project.schema.json index 654a115477..f706327fa6 100644 --- a/schemas/bolt-project.schema.json +++ b/schemas/bolt-project.schema.json @@ -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"