number4
2010-Feb-16 03:04 UTC
[Puppet Users] Can I get a list of affected hosts of a class change?
Hello puppet-users, Long-time listener, first-time caller ;) I was wondering if anyone has a good way to find all the classes and/or hosts that are affected by a change in a given module. So, say I have a module named ssh. It is inherited/included by a number of other classes. If I make a change to the ssh module, how can I get a list of all the classes and/or hosts in my environment that will be affected before I commit my changes? I am aware of the classes.txt file on the client, but I am looking for something on the server (puppetmaster) side so I have one place to determine all affected hosts. Is there some "best practice" I can follow to make this possible? Or is there anything that can be run to obtain this information? Any guidance or recommendation is appreciated. ----------- _| | |\/| ----------- -- 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.
Tim Stoop
2010-Feb-16 14:25 UTC
[Puppet Users] Re: Can I get a list of affected hosts of a class change?
Hi Jim, On 16 feb, 04:04, number4 <lousche...@yahoo.com> wrote:> I was wondering if anyone has > a > good way to find all the classes and/or hosts that are affected by a > change > in a given module.Not sure if you consider this a ''good'' way, but I have the following function: define register_class { @@line { "$fqdn uses the class $name": file => "/var/cache/puppet/classes/$name", line => "$fqdn", tag => "class-used-by", } } And every class starts with: class MyClass { register_class { "MyClass":; } .. do stuff } On my data host, I do: Line <<| tag == "class-used-by" |>> Et voila, a file per class that describes which hosts use them. I clean out the /var/cache/puppet directory every day via a cronjob, just to keep the data more or less fresh, since if you remove a class from a node, it doesn''t get removed from the file. Again, maybe someone else has a better solution, but this works for me. -- Kind regards, Tim -- 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.
number4
2010-Feb-16 22:53 UTC
[Puppet Users] Re: Can I get a list of affected hosts of a class change?
Ahh, yes. That''s an angle I hadn''t thought of. Thanks for the tip, Tim! I guess my only concern is relying on on a manual entry for the classes. So, if somebody creates a new class and forgets to add the register, we''ve lost integrity, but then again, it''s a whole lot better than what I have ;) This is great, thanks again. I appreciate the help! -- 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.
Scott Smith
2010-Feb-17 01:49 UTC
Re: [Puppet Users] Can I get a list of affected hosts of a class change?
On 2/15/10 7:04 PM, number4 wrote:> Hello puppet-users, > > Long-time listener, first-time caller ;) I was wondering if anyone has a good way to find all the > classes and/or hosts that are affected by a change in a given module. >You could parse the report yaml. That shows what classes were changed on a host, if any. I like Tim''s idea too. -scott -- 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.