Skip to content

Commit 9f61d16

Browse files
committed
(PUP-12077) Raise stringify_rich higher in the resource application code
1 parent b06a0de commit 9f61d16

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/puppet/application/resource.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ def main
146146
# If the specified environment does not exist locally, fall back to the default (production) environment
147147
env = Puppet.lookup(:environments).get(Puppet[:environment]) || create_default_environment
148148

149-
Puppet.override(:current_environment => env, :loaders => Puppet::Pops::Loaders.new(env)) do
149+
Puppet.override(
150+
current_environment: env,
151+
loaders: Puppet::Pops::Loaders.new(env),
152+
stringify_rich: true
153+
) do
150154
type, name, params = parse_args(command_line.args)
151155

152156
raise _("Editing with Yaml output is not supported") if options[:edit] and options[:to_yaml]
@@ -155,9 +159,7 @@ def main
155159

156160
if options[:to_yaml]
157161
data = resources.map do |resource|
158-
Puppet.override(stringify_rich: true) do
159-
resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash
160-
end
162+
resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash
161163
end.inject(:merge!)
162164
text = YAML.dump(type.downcase => data)
163165
else

0 commit comments

Comments
 (0)