Re: [Puppet Users] augeas and sendmail aliases

2010-06-17 Thread Christopher Johnston
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 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
> 
>
> 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-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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.



Re: [Puppet Users] augeas and sendmail aliases

2010-06-17 Thread Rob McBroom
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


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-us...@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.



Re: [Puppet Users] augeas and sendmail aliases

2010-06-16 Thread Silviu Paragina

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-us...@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.



Re: [Puppet Users] augeas and sendmail aliases

2010-06-16 Thread Rob McBroom
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


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-us...@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.



Re: [Puppet Users] augeas and sendmail aliases

2010-06-16 Thread Silviu Paragina
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:sil...@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] us...@mydomain.com",
 "set /files/etc/aliases/01/value[2] us...@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-us...@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.



RE: [Puppet Users] augeas and sendmail aliases

2010-06-16 Thread Sukh Khehra
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:sil...@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] us...@mydomain.com",
> "set /files/etc/aliases/01/value[2] us...@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-us...@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.



Re: [Puppet Users] augeas and sendmail aliases

2010-06-16 Thread R.I.Pienaar

> 
> 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


Is 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] us...@mydomain.com",
>>"set /files/etc/aliases/01/value[2] us...@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-us...@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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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.



Re: [Puppet Users] augeas and sendmail aliases

2010-06-16 Thread Silviu Paragina
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] us...@mydomain.com",
"set /files/etc/aliases/01/value[2] us...@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-us...@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.