On Tue, Nov 5, 2013 at 8:50 PM, Riju Francis <rijufran...@gmail.com> 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") Thanks, 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CACqVBqBa_v4%3D3uHDR2h8SpwDb0kjdYJW%2BHLDz-icxETrsry5Ag%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.