I'm going to try this again and hope I forgot to hit submit rather than 
having a message to the list pending for approval.

I want a list of classes contained in the puppet catalog that's been 
applied to the node, not management classes.  At least in mco 2.0.0 with 
minimal configuration, an mco inventory some.host or mco rpc rpcutil 
inventory -I some.host lists facts and mgmt classes.  Now, I'm fairly new 
to mcollective, so I might be missing something obvious, in which case I'd 
greatly appreciate being told what :)

What I started with was as an erb template for facts.yaml:
<% 
# Gather all of our scope variables
gather_vars = scope.to_hash.reject{ |k,v| k.to_s =~ 
/(uptime|free|timestamp|id|name|title|rsa|dsa)/ }
# And then all of classes
gather_vars.store('classcatalog', classes.sort.uniq.join(', ')) -%>
<%= gather_vars.to_yaml %>

And boom I can do an mco find --with-fact classcatalog=/corosync/ and it'll 
list all my nodes which use my corosync modules.

Which appears to work, but I'm a bit leary of this since so much in puppet 
depends on order of execution and I've seen some odd scoping issues with 
staging.  So while I have this being populated last, and use an ENC 90% of 
the time(which populates the management classes), and it all works, it 
might break in the future.  I was hoping there was another way of exposing 
this.

On Thursday, July 12, 2012 7:14:16 PM UTC-4, R.I. Pienaar wrote:
>
>
>
> ----- Original Message ----- 
> > From: "Nick Cammorato" <nick_cammor...@terc.edu> 
> > To: puppet-users@googlegroups.com 
> > Sent: Thursday, July 12, 2012 5:35:28 PM 
> > Subject: [Puppet Users] Using catalog 
> inventory/Puppet::Resource::Catalog? 
> > 
> > I'd like to be able to get a list of all of the classes being applied 
> > to my nodes and insert this as a list into mcollective's facts.yaml 
> > file. The reason for this is that I have a couple post-commit hooks 
> > that parse out changes to specific modules/classes for changelog 
> > purposes and I'm considering adding in a call to mco find to include 
> > a list of affected nodes in the report. Which means the facts need 
> > to be there to be found. 
>
> mcollective already knows what classes are on a host, you can access it 
> on the cli: 
>
> mco rpc rpcutil inventory -I some.host 
>
>

-- 
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/-/5PJdUxXAAaYJ.
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.

Reply via email to