So this is turning it into a small coding contest =). I needed
something similar to this, and there's a pretty easy way to do this
with the puppet resource_type face.
require 'puppet'
require 'puppet/face'
Puppet::Face[:resource_type,:current].search('*').find_all {|x|
x.type==:hostclass}.collect{|x|
x.name}.sort
You can do some interesting things, such as get all the classes
parameters as well:
Puppet::Face[:resource_type,:current].search('*').find_all {|x|
x.type==:hostclass}.collect{|x| {
x.name=>x.arguments.keys}}
Here's an example of classes and parameters it accept:
[{"apt::backports"=>["release", "location"]},
{"apt::debian::testing"=>[]},
{"apt::debian::unstable"=>[]},
{"apt::params"=>[]},
{"apt::release"=>["release_id"]},
{"apt::update"=>[]},
{"apt"=>
["purge_sources_list_d",
"purge_sources_list",
"always_apt_update",
"proxy_host",
"proxy_port",
"purge_preferences_d",
"disable_keys"]},
...
Thanks,
Nan
On Thu, Jul 12, 2012 at 9:50 AM, Nick Cammorato <
nick_ca...@terc.edu> wrote:
> You could do something like this, it's not the cleanest in the world(I
> barely ever use sed anymore), but as something quick and dirty:
> curl -k -H "Accept: yaml"
https://puppet:8140/mgmt/resource_types/class |
> more | grep " name: " | sed -e 's/^ *name: //;s/&id.* //' | sort | uniq
>
> It'll have some bad data you'll have to parse out(built-in classes like
> notify, fail, etc.), but should work.
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/puppet-users/-/m4XmKKAYwtkJ.