I am trying to add an entry to /etc/aliases using this but am unable to keep the entry from being added on every puppet run. I couldn''t figure out the proper "onlyif" attribute to use to add it only once. augeas{ "add sendmail alias" : context => "/files/etc/aliases", changes => [ "set /files/etc/aliases/01/name mycron", "set /files/etc/aliases/01/value[1] user1@mydomain.com", "set /files/etc/aliases/01/value[2] user2@pmydomain.com", ], } exec { "/usr/bin/newaliases": subscribe => Augeas["add sendmail alias"], refreshonly => true } Thanks for the help. Regards, Sukh -- 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.
Search in the list history for a thread named "augeas type and /etc/services" Silviu On 16.06.2010 20:38, Sukh Khehra wrote:> I am trying to add an entry to /etc/aliases using this but am unable to > keep the entry from being added on every puppet run. I couldn''t figure > out the proper "onlyif" attribute to use to add it only once. > > augeas{ "add sendmail alias" : > context => "/files/etc/aliases", > changes => [ > "set /files/etc/aliases/01/name mycron", > "set /files/etc/aliases/01/value[1] user1@mydomain.com", > "set /files/etc/aliases/01/value[2] user2@pmydomain.com", > ], > } > exec { "/usr/bin/newaliases": subscribe => Augeas["add sendmail > alias"], refreshonly => true } > > > Thanks for the help. > > Regards, > Sukh > >-- 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.
> > On 16.06.2010 20:38, Sukh Khehra wrote: >> I am trying to add an entry to /etc/aliases using this but am unable to >> keep the entry from being added on every puppet run. I couldn''t figureIs there something wrong with the puppet native type to manage this file?>> out the proper "onlyif" attribute to use to add it only once. >> >> augeas{ "add sendmail alias" : >> context => "/files/etc/aliases", >> changes => [ >> "set /files/etc/aliases/01/name mycron", >> "set /files/etc/aliases/01/value[1] user1@mydomain.com", >> "set /files/etc/aliases/01/value[2] user2@pmydomain.com", >> ], >> } >> exec { "/usr/bin/newaliases": subscribe => Augeas["add sendmail >> alias"], refreshonly => true } >> >> >> Thanks for the help. >> >> Regards, >> Sukh >> >> > > -- > 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.
Yes, I read that thread and thought I was ensuring path uniqueness by inserting the string "01" in there but its not working for me. I examined the tree using augtool and as expected did not see a subtree numbered at "01" so thought I should be be able to do this. Any other suggestions? -----Original Message----- From: Silviu Paragina [mailto:silviu@paragina.ro] Sent: Wednesday, June 16, 2010 11:31 AM To: puppet-users@googlegroups.com Cc: Sukh Khehra Subject: Re: [Puppet Users] augeas and sendmail aliases Search in the list history for a thread named "augeas type and /etc/services" Silviu On 16.06.2010 20:38, Sukh Khehra wrote:> I am trying to add an entry to /etc/aliases using this but am unableto> keep the entry from being added on every puppet run. I couldn''t figure > out the proper "onlyif" attribute to use to add it only once. > > augeas{ "add sendmail alias" : > context => "/files/etc/aliases", > changes => [ > "set /files/etc/aliases/01/name mycron", > "set /files/etc/aliases/01/value[1] user1@mydomain.com", > "set /files/etc/aliases/01/value[2] user2@pmydomain.com", > ], > } > exec { "/usr/bin/newaliases": subscribe => Augeas["add sendmail > alias"], refreshonly => true } > > > Thanks for the help. > > Regards, > Sukh > >-- 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.
I understood why that solution isn''t working. Not sure if I could put together a similar solution. The onlyif would probably look like match /files/etc/aliases/*[name=''mycron'' and count(value) = 2]/name size == 1 or match /files/etc/aliases/*[name=''mycron'']/value == [list of e-mail address] But Pienaar is right you should use the mailalias type if you can. Silviu On 16.06.2010 22:02, Sukh Khehra wrote:> Yes, I read that thread and thought I was ensuring path uniqueness by > inserting the string "01" in there but its not working for me. I > examined the tree using augtool and as expected did not see a subtree > numbered at "01" so thought I should be be able to do this. Any other > suggestions? > > -----Original Message----- > From: Silviu Paragina [mailto:silviu@paragina.ro] > Sent: Wednesday, June 16, 2010 11:31 AM > To: puppet-users@googlegroups.com > Cc: Sukh Khehra > Subject: Re: [Puppet Users] augeas and sendmail aliases > > Search in the list history for a thread named "augeas type and > /etc/services" > > > Silviu > > On 16.06.2010 20:38, Sukh Khehra wrote: > >> I am trying to add an entry to /etc/aliases using this but am unable >> > to > >> keep the entry from being added on every puppet run. I couldn''t figure >> out the proper "onlyif" attribute to use to add it only once. >> >> augeas{ "add sendmail alias" : >> context => "/files/etc/aliases", >> changes => [ >> "set /files/etc/aliases/01/name mycron", >> "set /files/etc/aliases/01/value[1] user1@mydomain.com", >> "set /files/etc/aliases/01/value[2] user2@pmydomain.com", >> ], >> } >> exec { "/usr/bin/newaliases": subscribe => Augeas["add sendmail >> alias"], refreshonly => true } >> >> >> Thanks for the help. >> >> Regards, >> Sukh >> >> >> >-- 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.
On Jun 16, 2010, at 3:02 PM, Sukh Khehra wrote:> Yes, I read that thread and thought I was ensuring path uniqueness by > inserting the string "01" in there but its not working for me. I > examined the tree using augtool and as expected did not see a subtree > numbered at "01" so thought I should be be able to do this. Any other > suggestions?If that’s the thread I’m thinking of, I was pretty heavily involved and I think you may have missed the point. You want a unique path that identifies the entry you’re trying to manipulate. * It needs to be unique so it won’t clobber an existing entry. * It needs to identify the target entry so Puppet will see that it exists on all but the initial run. By using 01 in the path somewhere, you’re only doing the first part, but since the 01 entry will never show up when Puppet looks at the file, it will assume it needs to add the entry (again and again). A unique path that identifies an entry in `/etc/aliases` would look something like this: /files/etc/aliases/*[name = ''ftp’] So with that, you can do things like: set /files/etc/aliases/*[name = ‘ftp’]/name ftp I’ve said before that Puppet encourages us to design things so they won’t hurt anything when run over and over, but the Augeas type seems to behave the opposite way by default in these “numbered item” contexts. Having said that, things have really improved with updates to both Augeas and Puppet and I think it’s an extremely valuable combo. It just takes some time to get comfortable with how it works. -- Rob McBroom <http://www.skurfer.com/> It''s not that I think guns, drugs, prostitution, swimming, eating and reading should be legal. It''s just that no one on Earth has the authority to make them illegal. -- 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.
On 16.06.2010 23:45, Rob McBroom wrote:> On Jun 16, 2010, at 3:02 PM, Sukh Khehra wrote: > > >> Yes, I read that thread and thought I was ensuring path uniqueness by >> inserting the string "01" in there but its not working for me. I >> examined the tree using augtool and as expected did not see a subtree >> numbered at "01" so thought I should be be able to do this. Any other >> suggestions? >> > > set /files/etc/aliases/*[name = ‘ftp’]/name ftp >I''ve actually tried this in augtool and puppet and it didn''t work. In puppet it fails silently and on first sight you would believe everything went ok. In augtool it simply fails. If this works for you could you please post your version and/or other tricks. Silviu -- 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.
On Jun 16, 2010, at 5:42 PM, Silviu Paragina wrote:>> set /files/etc/aliases/*[name = ‘ftp’]/name ftp >> > I''ve actually tried this in augtool and puppet and it didn''t work. In puppet it fails silently and on first sight you would believe everything went ok. In augtool it simply fails.So it does. It works with “print”, so I thought it would work with “set” as well. That was my experience with `/etc/services` and `/etc/passwd`. At this point, I’d look at all the possible path expressions and play around a bit. http://augeas.net/page/Path_expressions You may be stuck doing an “onlyif” after all. You might also try the native mail alias type, as someone else suggested. http://docs.puppetlabs.com/references/latest/type.html#mailalias -- Rob McBroom <http://www.skurfer.com/> Don''t try to tell me something is important to you if the whole of your “support” entails getting Congress to force *others* to spend time and money on it. -- 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.
I was never able to get this working properly for /etc/services, there is support in augeas now to do the matches properly but I think the ruby bindings are not up to date with the new changes which ended up making puppet fail. On Thu, Jun 17, 2010 at 9:06 AM, Rob McBroom <mailinglist0@skurfer.com>wrote:> On Jun 16, 2010, at 5:42 PM, Silviu Paragina wrote: > > >> set /files/etc/aliases/*[name = ‘ftp’]/name ftp > >> > > I''ve actually tried this in augtool and puppet and it didn''t work. In > puppet it fails silently and on first sight you would believe everything > went ok. In augtool it simply fails. > > So it does. It works with “print”, so I thought it would work with “set” as > well. That was my experience with `/etc/services` and `/etc/passwd`. At this > point, I’d look at all the possible path expressions and play around a bit. > > http://augeas.net/page/Path_expressions > > You may be stuck doing an “onlyif” after all. > > You might also try the native mail alias type, as someone else suggested. > > http://docs.puppetlabs.com/references/latest/type.html#mailalias > > -- > Rob McBroom > <http://www.skurfer.com/> > > Don''t try to tell me something is important to you if the whole of your > “support” entails getting Congress to force *others* to spend time and money > on it. > > -- > 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.