Skip to content

Commit 3ee2564

Browse files
committed
(PUP-12077) Use stringify_rich instead of rich_data in resource application
1 parent 91961bc commit 3ee2564

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

lib/puppet/application/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def main
155155

156156
if options[:to_yaml]
157157
data = resources.map do |resource|
158-
Puppet.override(rich_data: false) do
158+
Puppet.override(stringify_rich: true) do
159159
resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash
160160
end
161161
end.inject(:merge!)

spec/unit/application/resource_spec.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,6 @@ def string
170170
expect { @resource_app.main }.not_to raise_error
171171
end
172172

173-
it "should raise an error when printing yaml if rich_data is off" do
174-
@resource_app.options[:to_yaml] = true
175-
allow(@resource_app.command_line).to receive(:args).and_return(['stringify', 'hello', 'ensure=present', 'string=asd'])
176-
Puppet.override(rich_data: false) do
177-
expect { @resource_app.main }.to raise_error( Puppet::PreformattedError,
178-
/Stringify\[hello\]\['string'\] contains a Puppet::Util::Execution::ProcessOutput value. It will be converted to the String 'test'/)
179-
end
180-
end
181-
182173
it "should ensure all values to be printed are in the external encoding" do
183174
resources = [
184175
Puppet::Type.type(:user).new(:name => "\u2603".force_encoding(Encoding::UTF_8)).to_resource,

0 commit comments

Comments
 (0)