We have a lot of includes in our code so it takes some digging around to find the resultant set of classes that apply to a puppet clients. I was thinking of somehow copying classes.txt file from the client to the server for easier analysis. Anyone have any art on how to go about doing that? I''d appreciate any ideas. Regards, Sukh Khehra Sys Admin -- 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.
Sukh Khehra
2011-Jan-28 02:38 UTC
[Puppet Users] RE: each clients classes.txt on the server
Forgot to mention that we''re running 2.6.4 on the server and in the process of migrating all clients from 0.25.5 to 2.6.4. From: puppet-users@googlegroups.com [mailto:puppet-users@googlegroups.com] On Behalf Of Sukh Khehra Sent: Thursday, January 27, 2011 6:33 PM To: puppet-users@googlegroups.com Subject: [Puppet Users] each clients classes.txt on the server We have a lot of includes in our code so it takes some digging around to find the resultant set of classes that apply to a puppet clients. I was thinking of somehow copying classes.txt file from the client to the server for easier analysis. Anyone have any art on how to go about doing that? I''d appreciate any ideas. Regards, Sukh Khehra Sys Admin -- 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. -- 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.
Brian Gallew
2011-Jan-28 05:08 UTC
Re: [Puppet Users] RE: each clients classes.txt on the server
Interestingly enough, I wrote a custom fact to do that. In my case, I have and sshd_config.erb where I want to set the AllowGroups stanza based on all the classes applied to a node. With 2.6.1 I could achieve that effect simply by moving adding a class to the "post" stage (which is run after main) and have that class contain the relevant file{}. When I updated to 2.6.3 it started parsing the template the moment it encountered the resource, rather than waiting for the relevant stage to be reached. Now I just pass back a comma-separated list of all classes for each host and my erb knows how to handle that. A word or warning: as shipped, the fact_value field is VARCHAR($SMALL_VALUE) characters long. I had to change it to be a TEXT field because otherwise it truncated my data. On Thu, Jan 27, 2011 at 6:38 PM, Sukh Khehra <skhehra@proofpoint.com> wrote:> Forgot to mention that we’re running 2.6.4 on the server and in the > process of migrating all clients from 0.25.5 to 2.6.4. > > > > *From:* puppet-users@googlegroups.com [mailto: > puppet-users@googlegroups.com] *On Behalf Of *Sukh Khehra > *Sent:* Thursday, January 27, 2011 6:33 PM > *To:* puppet-users@googlegroups.com > *Subject:* [Puppet Users] each clients classes.txt on the server > > > > We have a lot of includes in our code so it takes some digging around to > find the resultant set of classes that apply to a puppet clients. I was > thinking of somehow copying classes.txt file from the client to the server > for easier analysis. Anyone have any art on how to go about doing that? I’d > appreciate any ideas. > > > > Regards, > > Sukh Khehra > > Sys Admin > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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.
Sukh Khehra
2011-Jan-30 21:43 UTC
RE: [Puppet Users] RE: each clients classes.txt on the server
Thank you Brian. Would you mind sharing the code for your custom fact that reads in /var/lib/puppet/classes.txt and presents it as a csv fact value. This would really save me some time as I am not a ruby developer. From: puppet-users@googlegroups.com [mailto:puppet-users@googlegroups.com] On Behalf Of Brian Gallew Sent: Thursday, January 27, 2011 9:08 PM To: puppet-users@googlegroups.com Subject: Re: [Puppet Users] RE: each clients classes.txt on the server Interestingly enough, I wrote a custom fact to do that. In my case, I have and sshd_config.erb where I want to set the AllowGroups stanza based on all the classes applied to a node. With 2.6.1 I could achieve that effect simply by moving adding a class to the "post" stage (which is run after main) and have that class contain the relevant file{}. When I updated to 2.6.3 it started parsing the template the moment it encountered the resource, rather than waiting for the relevant stage to be reached. Now I just pass back a comma-separated list of all classes for each host and my erb knows how to handle that. A word or warning: as shipped, the fact_value field is VARCHAR($SMALL_VALUE) characters long. I had to change it to be a TEXT field because otherwise it truncated my data. On Thu, Jan 27, 2011 at 6:38 PM, Sukh Khehra <skhehra@proofpoint.com<mailto:skhehra@proofpoint.com>> wrote: Forgot to mention that we''re running 2.6.4 on the server and in the process of migrating all clients from 0.25.5 to 2.6.4. From: puppet-users@googlegroups.com<mailto:puppet-users@googlegroups.com> [mailto:puppet-users@googlegroups.com<mailto:puppet-users@googlegroups.com>] On Behalf Of Sukh Khehra Sent: Thursday, January 27, 2011 6:33 PM To: puppet-users@googlegroups.com<mailto:puppet-users@googlegroups.com> Subject: [Puppet Users] each clients classes.txt on the server We have a lot of includes in our code so it takes some digging around to find the resultant set of classes that apply to a puppet clients. I was thinking of somehow copying classes.txt file from the client to the server for easier analysis. Anyone have any art on how to go about doing that? I''d appreciate any ideas. Regards, Sukh Khehra Sys Admin -- 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<mailto:puppet-users@googlegroups.com>. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com<mailto:puppet-users%2Bunsubscribe@googlegroups.com>. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. -- 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<mailto:puppet-users@googlegroups.com>. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com<mailto:puppet-users%2Bunsubscribe@googlegroups.com>. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. -- 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. -- 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.
Brian Gallew
2011-Jan-31 17:08 UTC
Re: [Puppet Users] RE: each clients classes.txt on the server
It''s a pretty trivial function: Facter.add(:cprt_classes) do setcode do open(''/var/lib/puppet/state/classes.txt'').read().split().join('','') rescue "" end end You''ll want to change cprt_classes to match your naming scheme. 2 caveats: 1) If you have more than a handful of classes, you''ll need to alter the fact_values.value field to be of type TEXT (or at least varchar(1024)). 2) If you reference this fact in your templates, be aware that the very first run will have no information and that it will, in fact, always lag one interation (e.g. you add a new class ssh:foo, it will take 2 puppet agent runs before that class shows up in the fact list) On Jan 30, 2011, at 1:43 PM, Sukh Khehra wrote:> Thank you Brian. Would you mind sharing the code for your custom fact that reads in /var/lib/puppet/classes.txt and presents it as a csv fact value. This would really save me some time as I am not a ruby developer. > > From: puppet-users@googlegroups.com [mailto:puppet-users@googlegroups.com] On Behalf Of Brian Gallew > Sent: Thursday, January 27, 2011 9:08 PM > To: puppet-users@googlegroups.com > Subject: Re: [Puppet Users] RE: each clients classes.txt on the server > > Interestingly enough, I wrote a custom fact to do that. In my case, I have and sshd_config.erb where I want to set the AllowGroups stanza based on all the classes applied to a node. With 2.6.1 I could achieve that effect simply by moving adding a class to the "post" stage (which is run after main) and have that class contain the relevant file{}. When I updated to 2.6.3 it started parsing the template the moment it encountered the resource, rather than waiting for the relevant stage to be reached. Now I just pass back a comma-separated list of all classes for each host and my erb knows how to handle that. A word or warning: as shipped, the fact_value field is VARCHAR($SMALL_VALUE) characters long. I had to change it to be a TEXT field because otherwise it truncated my data. > > On Thu, Jan 27, 2011 at 6:38 PM, Sukh Khehra <skhehra@proofpoint.com> wrote: > Forgot to mention that we’re running 2.6.4 on the server and in the process of migrating all clients from 0.25.5 to 2.6.4. > > From: puppet-users@googlegroups.com [mailto:puppet-users@googlegroups.com] On Behalf Of Sukh Khehra > Sent: Thursday, January 27, 2011 6:33 PM > To: puppet-users@googlegroups.com > Subject: [Puppet Users] each clients classes.txt on the server > > We have a lot of includes in our code so it takes some digging around to find the resultant set of classes that apply to a puppet clients. I was thinking of somehow copying classes.txt file from the client to the server for easier analysis. Anyone have any art on how to go about doing that? I’d appreciate any ideas. > > Regards, > Sukh Khehra > Sys Admin > -- > 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. > -- > 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. > > -- > 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. > > -- > 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.-- 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.