From d13f8ac4d5b8e4cf677c6c04fe875630216d6303 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 17 May 2010 12:28:19 -0700 Subject: Fixing #3671 - --compile Catalogs are pretty-printed A simple fix for this one. This doesn't fix the general case, just the --compile case. Signed-off-by: Luke Kanies --- lib/puppet/application/master.rb | 2 +- spec/unit/application/master.rb | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index 2433780c2..44c8c027b 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -59,7 +59,7 @@ class Puppet::Application::Master < Puppet::Application raise "Could not compile catalog for %s" % options[:node] end - $stdout.puts catalog.render(:pson) + jj catalog.to_resource rescue => detail $stderr.puts detail exit(30) diff --git a/spec/unit/application/master.rb b/spec/unit/application/master.rb index 362769e53..ff0c1994c 100644 --- a/spec/unit/application/master.rb +++ b/spec/unit/application/master.rb @@ -287,6 +287,7 @@ describe Puppet::Application::Master do Puppet.stubs(:[]).with(:environment) Puppet.stubs(:[]).with(:manifest).returns("site.pp") Puppet.stubs(:err) + @master.stubs(:jj) @master.stubs(:exit) Puppet.features.stubs(:pson?).returns true end @@ -304,13 +305,15 @@ describe Puppet::Application::Master do @master.compile end - it "should render the catalog to pson and print the output" do - @master.options[:node] = "foo" + it "should convert the catalog to a pure-resource catalog and use 'jj' to pretty-print the catalog" do catalog = Puppet::Resource::Catalog.new - catalog.expects(:render).with(:pson).returns "mypson" Puppet::Resource::Catalog.expects(:find).returns catalog - $stdout.expects(:puts).with("mypson") + catalog.expects(:to_resource).returns("rescat") + + @master.options[:node] = "foo" + @master.expects(:jj).with("rescat") + @master.compile end -- cgit