On Wed, Nov 6, 2013 at 10:10 AM, Nan Liu <[email protected]> wrote: > On Tue, Nov 5, 2013 at 8:50 PM, Riju Francis <[email protected]>wrote: > >> Is there a way to get the package version or service status using the >> puppet api calls? >> >> Following resource commands show version/status in the output: >> puppet resource package iptables >> puppet resource service iptables >> >> Can the api be used to get similar output? >> > > Puppet resource command is a face, so you can query via: > > > require 'puppet' > > require 'puppet/indirector/face' > > > puts Puppet::Face[:resource, '0.0.1'].find('package/linecache').to_pson > > > {"title":"linecache","exported":false,"tags":["package","linecache"],"type":"Package","parameters":{"provider":"gem","configfiles":"keep","loglevel":"notice","ensure":["0.46"]}} > > Look in the source code and there's additional examples such as listing > all resource of a type: > > all_users = Puppet::Face[:resource, '0.0.1'].search("user") >
Bla, have to read more carefully since subject makes a difference here, if you want to search puppet db use (which also supplies a puppet face): https://github.com/dalen/puppet-puppetdbquery Nan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CACqVBqCUP9fcgv%2BuGg5FL8dM9Qiy_Q1LwXV9Nzheen5kyCU%2BXQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
