summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/application/face_base.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/puppet/application/face_base.rb b/lib/puppet/application/face_base.rb
index 257d51f75..cc62257c7 100644
--- a/lib/puppet/application/face_base.rb
+++ b/lib/puppet/application/face_base.rb
@@ -36,15 +36,18 @@ class Puppet::Application::FaceBase < Puppet::Application
result = hook.call(result)
end
+ begin
+ render_method = Puppet::Network::FormatHandler.format(format).render_method
+ rescue
+ render_method = nil
+ end
+
if format == :for_humans then
render_for_humans(result)
+ elsif format == :json or render_method == "to_pson"
+ PSON::pretty_generate(result, :allow_nan => true, :max_nesting => false)
else
- render_method = Puppet::Network::FormatHandler.format(format).render_method
- if render_method == "to_pson"
- PSON::pretty_generate(result, :allow_nan => true, :max_nesting => false)
- else
- result.send(render_method)
- end
+ result.send(render_method)
end
end