[Puppet Users] Augeas Question

2014-04-28 Thread Pete Hartman
I hope this is an appropriate place for this question; if not, any 
redirection to a more appropriate place is appreciated.

So: I'm trying to set up puppet + augeas on an opensolaris system.  There 
are certain files I have that are under RCS version control--this is not 
all my doing, so some of these things I cannot change.  This creates files 
under /etc/ that are like filename,v.

I'm using puppet 2.7.22 and augeas 1.0.0.

Well, augtool, and apparently augeas invoked via puppet throw up on this. 
 Augtool reports

Failed to initialize Augeas
error: Invalid path expression
error: garbage at end of path expression
/augeas/files/etc/default/nfs|=|,v

I just want augeas to ignore these files...

I think the answer is to modify the 
/usr/local/share/augeas/lenses/dist/*.aug files that refer to things that 
are causing this grief and add excl clauses to explicitly exclude anything 
*,v. 

For example in shellvars.aug we have

let filter_default = incl /etc/default/*
. excl /etc/default/grub_installdevice*
. excl /etc/default/whoopsie

I've added 
. excl /etc/default/*,v

This appears to work.  But I'm not sure this is the right solution -- 
should I perhaps be making a copy of this to somewhere else and override 
the dist version?  Is there a more global way I could say ignore all files 
that have ,v after them ?

Thanks

Pete

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/017535fd-ff18-48e5-83eb-50d5f35b1a9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas Question

2014-04-28 Thread Kenton Brede
Not ab augeas expert but IIRC what I did in a similar situation is force
puppet/augeas to point to only one file.

Try adding context, incl, and lens to your augeas definition, like
the example below.  By specifying the lens, I think it helps speed up the
augeas type also.  At least I read that somewhere.  :)

  augeas { 'selinux_config':
context = '/files/etc/selinux/config',
incl= '/etc/selinux/config',
lens= 'Shellvars.lns',
changes = set SELINUX ${selinux_state},
  }

If I need to customize a lens, I stick it in /usr/share/augeas/lenses and
manage it with puppet.  I leave the lenses in /dist/ alone.
Kent


On Mon, Apr 28, 2014 at 2:56 PM, Pete Hartman pete.hart...@gmail.comwrote:

 I hope this is an appropriate place for this question; if not, any
 redirection to a more appropriate place is appreciated.

 So: I'm trying to set up puppet + augeas on an opensolaris system.  There
 are certain files I have that are under RCS version control--this is not
 all my doing, so some of these things I cannot change.  This creates files
 under /etc/ that are like filename,v.

 I'm using puppet 2.7.22 and augeas 1.0.0.

 Well, augtool, and apparently augeas invoked via puppet throw up on this.
  Augtool reports

 Failed to initialize Augeas
 error: Invalid path expression
 error: garbage at end of path expression
 /augeas/files/etc/default/nfs|=|,v

 I just want augeas to ignore these files...

 I think the answer is to modify the
 /usr/local/share/augeas/lenses/dist/*.aug files that refer to things that
 are causing this grief and add excl clauses to explicitly exclude anything
 *,v.

 For example in shellvars.aug we have

 let filter_default = incl /etc/default/*
 . excl /etc/default/grub_installdevice*
 . excl /etc/default/whoopsie

 I've added
 . excl /etc/default/*,v

 This appears to work.  But I'm not sure this is the right solution --
 should I perhaps be making a copy of this to somewhere else and override
 the dist version?  Is there a more global way I could say ignore all files
 that have ,v after them ?

 Thanks

 Pete

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/017535fd-ff18-48e5-83eb-50d5f35b1a9e%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/017535fd-ff18-48e5-83eb-50d5f35b1a9e%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
Kent Brede

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE38O8YSwLa9fbA1NCihs6DaHqkZedShiHPd_%2B%2BgdZ1z%2BKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] augeas question

2013-09-24 Thread Greg Coit
I've decided to not be blocked by this issue and to have puppet manage the 
config file.  It's not an ideal solution, but good enough until I learn 
more about either augeas or inifile.

Greg

On Monday, September 23, 2013 3:48:05 PM UTC-7, Greg Coit wrote:

 Nathan,

 Thanks for the response - I did not know about inifile.

 I unfortunately seem to be having trouble with ini_setting - the following 
 causes a new line to be added every time puppet gets run:

   ini_setting { 'anonymous_enable':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'anonymous_enable',
 value   = 'NO',
 ensure  = present,
   }

   ini_setting { 'chroot_local_user':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'chroot_local_user',
 value   = 'YES',
 ensure  = present,
   }

 BTW, still playing with augeas too - the most recent code is:

   augeas { 'vsftpd.conf':
 context   = '/files/vsftpd/vsftpd.conf',
 incl  = '/etc/vsftpd/vsftpd.conf',
 load_path = '/usr/share/augeas/lenses/dist/',
 lens  = 'vsftpd',
 changes   = [ 'set anonymous_enable NO', 'set chroot_local_user YES', 
 ],
   }

 Turns out that augeas has an unwelcome behavior - it tries to load all 
 files that match the lens - if any are non-standard, it errors out.  

 Greg

 On Monday, September 23, 2013 3:00:36 PM UTC-7, Nathan Valentine wrote:

 Greg, 

 I believe resource ini_setting would be appropriate here but I do 
 understand the desire to learn about Puppet + Augeas. 

augeas { 'vsftpd.conf':
  context = '/etc/vsftpd/vsftpd.conf',
  changes = [ 'set anonymous_enable=NO', 'set 
 chroot_local_user=YES', ],
  require = File['/etc/vsftpd/vsftpd.conf'],
}


 context = '*/files*/vsftpd/vsftpd.conf',

 ?

 I'm lazy and haven't tested with a Puppet apply but I think this might 
 just be an issue of understanding the namespace-y Augeas stuff. You can 
 test like so with augtool:

 $ augtool ls */files*/vsftpd/vsftpd.conf

 -- 
 ---
 Nathan Valentine - nat...@puppetlabs.com
 Puppet Labs Professional Services
 GV: 415.504.2173
 Skype: nrvale0



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-24 Thread Greg Coit

LOL - or I could just use one of the 2 vsftpd modules on puppetforge...  I 
never *intend* to do things the hard way.  :)

Greg

On Tuesday, September 24, 2013 9:32:53 AM UTC-7, Greg Coit wrote:

 I've decided to not be blocked by this issue and to have puppet manage the 
 config file.  It's not an ideal solution, but good enough until I learn 
 more about either augeas or inifile.

 Greg

 On Monday, September 23, 2013 3:48:05 PM UTC-7, Greg Coit wrote:

 Nathan,

 Thanks for the response - I did not know about inifile.

 I unfortunately seem to be having trouble with ini_setting - the 
 following causes a new line to be added every time puppet gets run:

   ini_setting { 'anonymous_enable':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'anonymous_enable',
 value   = 'NO',
 ensure  = present,
   }

   ini_setting { 'chroot_local_user':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'chroot_local_user',
 value   = 'YES',
 ensure  = present,
   }

 BTW, still playing with augeas too - the most recent code is:

   augeas { 'vsftpd.conf':
 context   = '/files/vsftpd/vsftpd.conf',
 incl  = '/etc/vsftpd/vsftpd.conf',
 load_path = '/usr/share/augeas/lenses/dist/',
 lens  = 'vsftpd',
 changes   = [ 'set anonymous_enable NO', 'set chroot_local_user 
 YES', ],
   }

 Turns out that augeas has an unwelcome behavior - it tries to load all 
 files that match the lens - if any are non-standard, it errors out.  

 Greg

 On Monday, September 23, 2013 3:00:36 PM UTC-7, Nathan Valentine wrote:

 Greg, 

 I believe resource ini_setting would be appropriate here but I do 
 understand the desire to learn about Puppet + Augeas. 

augeas { 'vsftpd.conf':
  context = '/etc/vsftpd/vsftpd.conf',
  changes = [ 'set anonymous_enable=NO', 'set 
 chroot_local_user=YES', ],
  require = File['/etc/vsftpd/vsftpd.conf'],
}


 context = '*/files*/vsftpd/vsftpd.conf',

 ?

 I'm lazy and haven't tested with a Puppet apply but I think this might 
 just be an issue of understanding the namespace-y Augeas stuff. You can 
 test like so with augtool:

 $ augtool ls */files*/vsftpd/vsftpd.conf

 -- 
 ---
 Nathan Valentine - nat...@puppetlabs.com
 Puppet Labs Professional Services
 GV: 415.504.2173
 Skype: nrvale0



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-24 Thread Werner Flamme
Greg Coit [24.09.2013 00:48]:
 
 BTW, still playing with augeas too - the most recent code is:
 
   augeas { 'vsftpd.conf':
 context   = '/files/vsftpd/vsftpd.conf',

Greg,

shouldn't this be '/files/etc/vsftpd/vsftpd.conf'?

Just a guess from a novice...

Regards,
Werner
-- 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] augeas question

2013-09-23 Thread Greg Coit
Hello,

I'm trying to learn how to use augeas in puppet.  One of the packages we 
have puppet installing is vsftpd.  Rather than putting the vsftpd conf file 
in puppet (in case the config file is updated by the upstream maintainers) 
I'd like to use augeas to make sure the correct lines exist in the config 
file.

Currently, the default vsftpd config file contains the following 21 lines 
(among others of course):

anonymous_enable=YES
#chroot_local_user=YES

I'd like to change this to:

anonymous_enable=NO
chroot_local_user=YES

I have the following in a module:

  #vsftpd
  package { 'vsftpd':
ensure = installed,
  }

  file { '/etc/vsftpd/vsftpd.conf':
ensure  = file,
mode= 600,
require = Package['vsftpd'],
  }

  augeas { 'vsftpd.conf':
context = '/etc/vsftpd/vsftpd.conf',
changes = [ 'set anonymous_enable=NO', 'set chroot_local_user=YES', ],
require = File['/etc/vsftpd/vsftpd.conf'],
  }

But I'm having no luck changing either line.

Any suggestions are welcome - thanks!

Greg

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-23 Thread Nathan Valentine
Greg,

I believe resource ini_setting would be appropriate here but I do
understand the desire to learn about Puppet + Augeas.

   augeas { 'vsftpd.conf':
 context = '/etc/vsftpd/vsftpd.conf',
 changes = [ 'set anonymous_enable=NO', 'set chroot_local_user=YES',
],
 require = File['/etc/vsftpd/vsftpd.conf'],
   }


context = '*/files*/vsftpd/vsftpd.conf',

?

I'm lazy and haven't tested with a Puppet apply but I think this might just
be an issue of understanding the namespace-y Augeas stuff. You can test
like so with augtool:

$ augtool ls */files*/vsftpd/vsftpd.conf

-- 
---
Nathan Valentine - nat...@puppetlabs.com
Puppet Labs Professional Services
GV: 415.504.2173
Skype: nrvale0

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-23 Thread Greg Coit
Nathan,

Thanks for the response - I did not know about inifile.

I unfortunately seem to be having trouble with ini_setting - the following 
causes a new line to be added every time puppet gets run:

  ini_setting { 'anonymous_enable':
path= '/etc/vsftpd/vsftpd.conf',
setting = 'anonymous_enable',
value   = 'NO',
ensure  = present,
  }

  ini_setting { 'chroot_local_user':
path= '/etc/vsftpd/vsftpd.conf',
setting = 'chroot_local_user',
value   = 'YES',
ensure  = present,
  }

BTW, still playing with augeas too - the most recent code is:

  augeas { 'vsftpd.conf':
context   = '/files/vsftpd/vsftpd.conf',
incl  = '/etc/vsftpd/vsftpd.conf',
load_path = '/usr/share/augeas/lenses/dist/',
lens  = 'vsftpd',
changes   = [ 'set anonymous_enable NO', 'set chroot_local_user YES', 
],
  }

Turns out that augeas has an unwelcome behavior - it tries to load all 
files that match the lens - if any are non-standard, it errors out.  

Greg

On Monday, September 23, 2013 3:00:36 PM UTC-7, Nathan Valentine wrote:

 Greg, 

 I believe resource ini_setting would be appropriate here but I do 
 understand the desire to learn about Puppet + Augeas. 

augeas { 'vsftpd.conf':
  context = '/etc/vsftpd/vsftpd.conf',
  changes = [ 'set anonymous_enable=NO', 'set chroot_local_user=YES', 
 ],
  require = File['/etc/vsftpd/vsftpd.conf'],
}


 context = '*/files*/vsftpd/vsftpd.conf',

 ?

 I'm lazy and haven't tested with a Puppet apply but I think this might 
 just be an issue of understanding the namespace-y Augeas stuff. You can 
 test like so with augtool:

 $ augtool ls */files*/vsftpd/vsftpd.conf

 -- 
 ---
 Nathan Valentine - nat...@puppetlabs.com javascript:
 Puppet Labs Professional Services
 GV: 415.504.2173
 Skype: nrvale0


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas question ab

2012-02-17 Thread Dominic Cleal
On 15/02/12 08:10, Steve Shipway wrote:
 This is only a guess, but is Augeas doing a STRING comparison of the values 
 instead of a NUMERICAL one?
 
 String-wise,   7000  80 but numerically it's the other way around.
 
 Can you try setting the current value to '1' and see if Augeas wants to 
 change it to 784009728.  If it does, then that's the issue.
 
 As to WHY it would be doing a string-wise comparison, I don't know.  It could 
 be down to the version of  Augeas or the Puppet agent.  Try upgrading to the 
 latest and test it again...

I'm pretty sure you're right with this.  From a quick look at the code,
then it's simply not designed to work with integer values in settings.

You'd need to file an RFE against Puppet for this, as the conditionals
are implemented in the provider (not part of Augeas at all).

-- 
Dominic Cleal
Red Hat Consulting
m: +44 (0)7817 878113

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



RE: [Puppet Users] Augeas question ab

2012-02-15 Thread Steve Shipway
This is only a guess, but is Augeas doing a STRING comparison of the values 
instead of a NUMERICAL one?

String-wise,   7000  80 but numerically it's the other way around.

Can you try setting the current value to '1' and see if Augeas wants to change 
it to 784009728.  If it does, then that's the issue.

As to WHY it would be doing a string-wise comparison, I don't know.  It could 
be down to the version of  Augeas or the Puppet agent.  Try upgrading to the 
latest and test it again...

Steve

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.ship...@auckland.ac.nz
Ph: +64 9 373 7599 ext 86487



From: puppet-users@googlegroups.com [puppet-users@googlegroups.com] on behalf 
of rvlinden [rene.vanderlinde...@gmail.com]
Sent: Wednesday, 15 February 2012 10:26 a.m.
To: Puppet Users
Subject: [Puppet Users] Augeas question ab

Hi,

I'm having some 'strange' issues with augeas and an onlyif statement

This is my code

augeas { classx_sysctl_shmmax:
incl= '/etc/sysctl.conf',
lens= 'Sysctl.lns',
changes = set kernel.shmmax ${sysctl_kernel_shmmax},
onlyif  = get kernel.shmmax  ${sysctl_kernel_shmmax},
}

I only want to change the kernel.shmmax in /etc/sysctl.conf when the
value is greater than what is currently configured.

For example
kernel.shmmax defauls to 784009728 and I changed it manually to
784009729 (so +1)
= When puppet runs, nothing needs to be done (as expected)

kernel.shmmax defaults to 784009728 and I changed it manually to
784009727 (so -1)
When puppet runs, it wants to change the value (as expected)

-kernel.shmmax = 784009727
+kernel.shmmax = 784009728
notice: /Stage[main]/Classx/Augeas[classx_sysctl_shmmax]/returns:
current_value need_to_run, should be 0 (noop)

So for now, everything looks fine, however ...
If I change the value to something really small, like from 784009728
to 84009728 (removed the first digit), pupppet does not want to change
it anymore.

What I can see is that puppet/augeas only evaluates values correctly
as long as the number of digits stays the same, so

100 is less than 101
101 is greater than 100
but 99 is greater than 100 ?!? :-(

Anyone an idea how I can configure augeas to do this correctly ??

Regards,
Rene

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