You could use the resource_type indirection to query all of the resource
types and select the ones of type node.

This will only query the nodes that were specified in manifests (which is
quite different from all of the nodes that have checked in)

Below is some example code:

require "puppet/face"
Puppet::Face[:resource_type,:current].search("*").find_all {|x| x.type ==
:node }.collect {|y| y.name }

On Mon, Nov 21, 2011 at 4:43 PM, Trevor Vaughan <tvaug...@onyxpoint.com>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thanks for the suggestions guys but I'm giving this one up as too annoying
> to bother.
>
> The issue was to detect the nodes that hadn't checked in but were defined
> in the manifest.
>
> Getting the information out of the YAML is pretty easy, yes.
>
> Thanks!
>
> Trevor
>
> On 11/21/2011 12:10 PM, Brian Gallew wrote:
> > This is (almost) trivial.
> > First, create a fact that turns /var/lib/puppet/state/classes.txt into
> an array.  Then extract that fact from the storedconfigs DB
> programmatically.  Admittedly, this won't get all defined nodes, as that is
> somewhat meaningless since nodes can be "default" or regular exceptions.
>  Instead, this gets all nodes that have run Puppet at least once.
> >
> > On Nov 20, 2011, at 6:04 PM, James Turnbull wrote:
> >
> >> Trevor Vaughan wrote:
> >>> Sorry but...bump?
> >>>
> >>> On 11/18/2011 02:20 PM, Trevor Vaughan wrote:
> >>>> Sorry if this is a double post, my e-mail glitched on me.
> >>>
> >>>> Anyway, I'm trying to write a Ruby script that can get all defined
> >>>> nodes and all classes assigned to those nodes. I would prefer to not
> >>>> have to compile a catalog for each node.
> >>>
> >>>> I tried looking through the puppet/util/rdoc material but it really
> >>>> didn't handle the node entries as far as I could tell and also didn't
> >>>> seem to have a way to get the info without printing it all out.
> >>>
> >>
> >> Sorry missed this one - I do something vaguely similar for the Puppet
> >> Rundeck integration - have a look at the code at:
> >>
> >> https://github.com/jamtur01/puppet-rundeck
> >>
> >> Others may be able to chime in with better ideas.
> >>
> >> James
> >>
> >> --
> >> James Turnbull
> >> Puppet Labs
> >> 1-503-734-8571
> >> To schedule a meeting with me: http://tungle.me/jamtur01
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> >> To post to this group, send email to puppet-us...@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.
> >>
> >
>
> - --
> Trevor Vaughan
>  Vice President, Onyx Point, Inc.
>  email: tvaug...@onyxpoint.com
>  phone: 410-541-ONYX (6699)
>  pgp: 0x6C701E94
>
> - -- This account not approved for unencrypted sensitive information --
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iQEcBAEBAgAGBQJOyvARAAoJECNCGV1OLcypxvYH/03J2v+V+ReyewLkA5wynTq+
> J9NbiXjwqKK7RZOlB+LFrIbR8/OBP46zRLSI0iujfwua3vwQromA9wga59e9XvuL
> vFsKiKmwxArzcrafuTNnIk47jyV6vvYvxq7roIqcU0kQIj9rECEJSkktNI/gy8PK
> DMiIMqNSz6jGw+ZUAhWJMQtvzLZ73BiFl61WKFH0NEAM1uBIidp4hfPQ9Bn2OVPJ
> TLfGlN2/nuFVUFU6SgDICFsaXKuM6Cc4CnUH1o+UJH6SKXXZBtnuXZDncmwsA4ez
> BG+fP3rfS4q3EzZYrl05zFh4frsLyo5PQDYKTZyALPDY9QmZvkHQ62IloFLYcdY=
> =8sEZ
> -----END PGP SIGNATURE-----
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To post to this group, send email to puppet-dev@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>
>

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

Reply via email to