diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-02 12:46:09 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-02 15:34:52 -0700 |
| commit | a4a274b8c7807fdf35199dc20889de599ea912ca (patch) | |
| tree | 330ab4c33b57d7635bdcbaf5faf62a50f050564f | |
| parent | a71bfa10123276b1dc96c5ef540b9fbf222c2f6d (diff) | |
| download | puppet-a4a274b8c7807fdf35199dc20889de599ea912ca.tar.gz puppet-a4a274b8c7807fdf35199dc20889de599ea912ca.tar.xz puppet-a4a274b8c7807fdf35199dc20889de599ea912ca.zip | |
(#7315) Fix `to_pson` method to render correctly.
Puppet::Status had an outdated implementation of the `to_pson` hook, so would
fail to render when asked. Changes to the faces system exposed this,
resulting in a backtrace if the user wanted JSON output on the CLI.
Reviewed-By: Nick Lewis <nick@puppetlabs.com>
| -rw-r--r-- | lib/puppet/status.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/status_spec.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/puppet/status.rb b/lib/puppet/status.rb index eecd0e18c..ea6a601f3 100644 --- a/lib/puppet/status.rb +++ b/lib/puppet/status.rb @@ -10,7 +10,7 @@ class Puppet::Status @status = status || {"is_alive" => true} end - def to_pson + def to_pson(*args) @status.to_pson end diff --git a/spec/unit/status_spec.rb b/spec/unit/status_spec.rb index 820807638..0c572fd95 100755 --- a/spec/unit/status_spec.rb +++ b/spec/unit/status_spec.rb @@ -15,6 +15,10 @@ describe Puppet::Status do Puppet::Status.new.status.to_pson.should == '{"is_alive":true}' end + it "should render to a pson hash" do + PSON::pretty_generate(Puppet::Status.new).should =~ /"is_alive":\s*true/ + end + it "should accept a hash from pson" do status = Puppet::Status.new( { "is_alive" => false } ) status.status.should == { "is_alive" => false } |
