summaryrefslogtreecommitdiffstats
path: root/lib/puppet/status.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-01-21 17:16:38 -0800
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit9acd0b2b6d83881dc529c117637aff63a6c44f8d (patch)
tree99d1d7939f2cb032d555717d8a90d32719f96691 /lib/puppet/status.rb
parentb581c2348e784ce5d857a4c1c0686399b87cc13f (diff)
downloadpuppet-9acd0b2b6d83881dc529c117637aff63a6c44f8d.tar.gz
puppet-9acd0b2b6d83881dc529c117637aff63a6c44f8d.tar.xz
puppet-9acd0b2b6d83881dc529c117637aff63a6c44f8d.zip
Feature #3115 REST-ified status()
This patch re-implements the status() remote procedure as a REST interface. A running server returns key-value pairs, currently the only implemented key is "is_alive" which will always be set to true. Some future tool will consume this by: Puppet::Status.indirection.terminus_class = :rest Puppet::Status.find('https://puppet:8140/production/status/default') Now with unit tests. plus fixes a typo. plus integration test and default security setting. plus tests suggested by Brice. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'lib/puppet/status.rb')
-rw-r--r--lib/puppet/status.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/puppet/status.rb b/lib/puppet/status.rb
new file mode 100644
index 000000000..f587a5a2a
--- /dev/null
+++ b/lib/puppet/status.rb
@@ -0,0 +1,20 @@
+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
+end