It doesn't seem to have the issue:

Puppet::Face[:resource_type,:current].search('*').collect{|x| x.type}
=> [:hostclass, :node]

Puppet::Face[:resource_type,:current].search('demo').collect{|x| x.type}
=> [:hostclass, :node]

Nan

On Fri, Jul 13, 2012 at 11:41 AM, Nigel Kersten <ni...@puppetlabs.com> wrote:
> Nan, I just assigned https://projects.puppetlabs.com/issues/7079 to
> you, it would be awesome if you could let us know in that ticket if
> your sample code suffers the same problem of classes with the same
> name as a node masking the existence of that node.
>
> On Thu, Jul 12, 2012 at 5:17 PM, Nan Liu <n...@puppetlabs.com> wrote:
>> 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_cammor...@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.
>>>
>>>
>>> On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote:
>>>>
>>>> Is there a way to get a list of all the classes available from the puppet
>>>> master?
>>>>
>>>> I have 2 goals for this - one is documentation in a human readable form,
>>>> and the other is potentially importing that data into dashboard.
>>>>
>>>> I did find some info on the rest API
>>>> (http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I
>>>> can't make any sense of the output from it.
>>>>
>>>> Thanks.
>>>>
>>>> Lee
>>>
>>>
>>> On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote:
>>>>
>>>> Is there a way to get a list of all the classes available from the puppet
>>>> master?
>>>>
>>>> I have 2 goals for this - one is documentation in a human readable form,
>>>> and the other is potentially importing that data into dashboard.
>>>>
>>>> I did find some info on the rest API
>>>> (http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I
>>>> can't make any sense of the output from it.
>>>>
>>>> Thanks.
>>>>
>>>> Lee
>>>
>>>
>>> On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote:
>>>>
>>>> Is there a way to get a list of all the classes available from the puppet
>>>> master?
>>>>
>>>> I have 2 goals for this - one is documentation in a human readable form,
>>>> and the other is potentially importing that data into dashboard.
>>>>
>>>> I did find some info on the rest API
>>>> (http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I
>>>> can't make any sense of the output from it.
>>>>
>>>> Thanks.
>>>>
>>>> Lee
>>>
>>>
>>> On Thursday, July 12, 2012 11:54:25 AM UTC-4, llo...@oreillyauto.com wrote:
>>>>
>>>> Is there a way to get a list of all the classes available from the puppet
>>>> master?
>>>>
>>>> I have 2 goals for this - one is documentation in a human readable form,
>>>> and the other is potentially importing that data into dashboard.
>>>>
>>>> I did find some info on the rest API
>>>> (http://docs.puppetlabs.com/guides/rest_api.html#resource-types ) but I
>>>> can't make any sense of the output from it.
>>>>
>>>> Thanks.
>>>>
>>>> Lee
>>>
>>> --
>>> 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.
>>>
>>> To post to this group, send email to puppet-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> puppet-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/puppet-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Puppet Users" group.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>
>
> --
> Nigel Kersten | http://puppetlabs.com | @nigelkersten
> Schedule Meetings at: http://tungle.me/nigelkersten
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to