[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Daniel Pittman
daniel at puppetlabs.com
Tue May 10 08:19:13 UTC 2011
The following commit has been merged in the experimental branch:
commit 48903f58e535dabd55b6895eae1dc1967553391a
Author: Luke Kanies <luke at puppetlabs.com>
Date: Wed Apr 27 23:04:20 2011 +0100
(#7278) Improve utility of the Catalog select action
This extends the catalog select action to be able to return more than a single
type, as well as supporting both programmatic and human focused rendering of
the return value.
Reviewed-By: Daniel Pittman <daniel at puppetlabs.com>
diff --git a/lib/puppet/face/catalog/select.rb b/lib/puppet/face/catalog/select.rb
index ba27117..a8ecd82 100644
--- a/lib/puppet/face/catalog/select.rb
+++ b/lib/puppet/face/catalog/select.rb
@@ -2,9 +2,25 @@
Puppet::Face.define(:catalog, '0.0.1') do
action :select do
when_invoked do |host, type, options|
+ # REVISIT: Eventually, type should have a default value that triggers
+ # the non-specific behaviour. For now, though, this will do.
+ # --daniel 2011-05-03
catalog = Puppet::Resource::Catalog.indirection.find(host)
- catalog.resources.reject { |res| res.type != type }.each { |res| puts res }
+ if type == '*'
+ catalog.resources
+ else
+ type = type.downcase
+ catalog.resources.reject { |res| res.type.downcase != type }
+ end
+ end
+
+ when_rendering :for_humans do |value|
+ if value.nil? then
+ "no matching resources found"
+ else
+ value.map {|x| x.to_s }.join("\n")
+ end
end
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list