diff --git a/lib/puppet/status.rb b/lib/puppet/status.rb index f587a5a2a..aaec5d3ba 100644 --- a/lib/puppet/status.rb +++ b/lib/puppet/status.rb @@ -1,20 +1,28 @@ require 'puppet/indirector' class Puppet::Status extend Puppet::Indirector indirects :status, :terminus_class => :local attr :status, true def initialize( status = nil ) @status = status || {"is_alive" => true} end def to_pson @status.to_pson end def self.from_pson( pson ) self.new( pson ) end + + def name + "status" + end + + def name=(name) + # NOOP + end end diff --git a/spec/unit/status.rb b/spec/unit/status.rb index b13b246af..334b9b50a 100644 --- a/spec/unit/status.rb +++ b/spec/unit/status.rb @@ -1,23 +1,31 @@ #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../spec_helper' describe Puppet::Status do it "should implement find" do Puppet::Status.find( :default ).should be_is_a(Puppet::Status) Puppet::Status.find( :default ).status["is_alive"].should == true end it "should default to is_alive is true" do Puppet::Status.new.status["is_alive"].should == true end it "should return a pson hash" do Puppet::Status.new.status.to_pson.should == '{"is_alive":true}' end it "should accept a hash from pson" do status = Puppet::Status.new( { "is_alive" => false } ) status.status.should == { "is_alive" => false } end + + it "should have a name" do + Puppet::Status.new.name + end + + it "should allow a name to be set" do + Puppet::Status.new.name = "status" + end end