On Thu, Dec 6, 2012 at 4:50 AM, ollies...@googlemail.com < paul.seym...@barcap.com> wrote:
> Hello, > > Is there anyway to parse a catalog generated with something like:- > > puppet master --compile <host> > <hostname>.cat > > That looks vaguely human readable. I have tried the "puppet catalog print" > face but cannot seem to get it to parse for some reason > > # puppet catalog print --catalog /var/tmp/<hostname>.cat > err: undefined method `preferred_run_mode=' for > #<Puppet::Util::Settings:0x7fa5ef9d6948> > err: Try 'puppet help catalog print' for usage > > This is on a 2.7.16 master BTW > > Or indeed anything in the PuppetDB that can pull this and parse it ? > On the PuppetDB side, there are two ways off the top of my head (newer versions will pretty-print the output, making it more human-readable JSON). These assume you're on the same machine PuppetDB is on: * you can issue a query for all resources for <hostname>, like so: curl -G -H "Accept: application/json" 'http://localhost:8080/resources' --data-urlencode 'query=["=", ["node", "name"], "<hostname>"]' Note that you won't get dependency or containment edges here, but you will get all parameters for all resources for the host. This is much easier with the changes in the PuppetDB master branch (hasn't been released yet, but figured i'd mention it), which lets you just hit /v2/nodes/<hostname>/resources to get all of them without requiring a query. * you can use the experimental "catalog" endpoint: curl -v -H 'Accept: application/json' ' http://localhost:8080/experimental/catalog/<hostname>' That will give you all dependency edges, all containment edges, and all resources + parameters. deepak -- 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.