diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-03 12:56:25 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-03 12:56:25 -0700 |
commit | b7ba66c8ebd7d59de40188a70b4e6fa0ddd8d2ad (patch) | |
tree | 9b8b08de2f32da39aa0c5fcac382bee945aafa6e | |
parent | 50d18e1fda174a04e5251207f3a39e3ae6cbb891 (diff) | |
parent | 48903f58e535dabd55b6895eae1dc1967553391a (diff) | |
download | puppet-b7ba66c8ebd7d59de40188a70b4e6fa0ddd8d2ad.tar.gz puppet-b7ba66c8ebd7d59de40188a70b4e6fa0ddd8d2ad.tar.xz puppet-b7ba66c8ebd7d59de40188a70b4e6fa0ddd8d2ad.zip |
Merge branch 'feature/2.7.x/7278-improve-catalog-select-action' into 2.7.x
-rw-r--r-- | lib/puppet/face/catalog/select.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/puppet/face/catalog/select.rb b/lib/puppet/face/catalog/select.rb index ba27117bc..a8ecd82fa 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 |