OlliesDad@googlemail.com
2012-Dec-06 11:50 UTC
[Puppet Users] Catalog into something "human readable"
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 ? Thanks -- 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/-/u4awwsOj2uAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2012-Dec-06 17:52 UTC
Re: [Puppet Users] Catalog into something "human readable"
----- Original Message -----> From: "OlliesDad@googlemail.com" <Paul.Seymour@barcap.com> > To: puppet-users@googlegroups.com > Sent: Thursday, December 6, 2012 1:50:56 PM > Subject: [Puppet Users] Catalog into something "human readable" > > 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 BTWthe print face needs puppet 3. you can try an older version that was just a script @ https://github.com/ripienaar/puppet-parselocalconfig/tree/5430c173d373052f0cdf764cb30a590ec3e729d1 -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Deepak Giridharagopal
2012-Dec-06 19:04 UTC
Re: [Puppet Users] Catalog into something "human readable"
On Thu, Dec 6, 2012 at 4:50 AM, OlliesDad@googlemail.com < Paul.Seymour@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.