Guy,

The way augeas works is each lens has filters for which files it
should include and exclude.  The --noload switch tells augtool not to
automatically load the lenses in /usr/share/augeas/ so it does not see
these filters.  You then have to manually load a lens and tell it
which files to parse.

The PHP lens on my machine for example includes the following files by default.

augtool> print /augeas/load/PHP/incl
/augeas/load/PHP/incl[1] = "/usr/local/zend/etc/conf.d/*.ini"
/augeas/load/PHP/incl[2] = "/usr/local/zend/etc/php.ini"
/augeas/load/PHP/incl[3] = "/etc/php.d/*.ini"
/augeas/load/PHP/incl[4] = "/etc/php.ini"
/augeas/load/PHP/incl[5] = "/etc/php*/*/*.ini"

What version of puppet are you using?  There is a patch in newer
versions that prints the output of /augeas//error when --debug is used
but if you are like me and stuck on an older version you won't get get
/augeas//error.

Instead of using context can you try using a fully qualified set
statement?  I did find a case where context failed me.

augeas { 'set_php_errorlog':
  notify    => Service['php5-fpm'],
  require   => Package['php5-fpm'],
  changes   => [
    "set /files/etc/php5/fpm/php.ini/PHP/error_log /var/log/php/php.log",
  ],
}

-Alan

On Fri, Jun 15, 2012 at 5:00 PM, Guy Knights <[email protected]> 
wrote:
> Yeah, I tried --debug in my puppet command and it didn't give me any errors.
> In my original message i did say I tried doing the set from augtool and it
> worked, but I just tried it again with augtool --noload and it can't find
> anything to do with the sudoers file. It's like it's not reading the
> file...or something, I'm not overly familiar with how augeas does stuff
> behind the scenes.
>
> In my augeas lenses folder on the server I have both php.aug and
> sudoers.aug, and like I said, when I run augtool without --noload I can
> access these config files and change items perfectly fine.
>
> Thanks,
> Guy
>
>
> On Fri, Jun 15, 2012 at 1:50 PM, Alan Evans <[email protected]> wrote:
>>
>> Guy,
>>
>> Check the debug output of the agent.  puppetd --debug or puppet agent
>> --debug (I think)
>>
>> Or try running the same set with augtool from the command line.
>>
>> # augtool --noload
>> augtool> set /files/etc/php5/fpm/php.ini/PHP/error_log
>> /var/log/php/php.log
>> augtool> print /augeas//error
>>
>> See what the output of /augeas//error is.
>>
>> I suspect augeas doesn't have a lens that knows about
>> /etc/php5/fpm/php.ini file.
>>
>> You might have to change your augeas type to something like:
>>
>> augeas { 'set_php_errorlog':
>>   notify    => Service['php5-fpm'],
>>   require   => Package['php5-fpm'],
>>   lens   => 'IniFile.lns',
>>   incl   => '/etc/php5/fpm/php.ini',
>>   context   => '/files/etc/php5/fpm/php.ini',
>>   changes   => [
>>     "set /PHP/error_log /var/log/php/php.log",
>>   ],
>> }
>>
>> Some relevant links.
>> http://projects.puppetlabs.com/projects/1/wiki/Puppet_Augeas
>> http://augeas.net/docs/references/lenses/files/inifile-aug.html
>>
>> Regards,
>> -Alan
>>
>>
>> On Fri, Jun 15, 2012 at 2:47 PM, Guy Knights <[email protected]>
>> wrote:
>> > I've recently configured a couple of augeas resources, one for a php.ini
>> > file and one for sudoers, however neither set of changes is being saved.
>> > I
>> > have no idea why. The sudoers resource is here:
>> >
>> >    augeas { 'set_sudoers':
>> >      context    => '/files/etc/sudoers/spec[user="%sudo"]',
>> >      changes    => 'set /host_group/command/tag NOPASSWD',
>> >    }
>> >
>> > I've tested the above using augtool ('set
>> > /files/etc/sudoers/spec[user="%sudo"]/host_group/command/tag NOPASSWD',
>> > followed by 'save') and it works fine. It seems like puppet isn't saving
>> > the
>> > change.
>> >
>> > Here's the one for php.ini that is also not working:
>> >
>> >    augeas { 'set_php_errorlog':
>> >       notify    => Service['php5-fpm'],
>> >       require   => Package['php5-fpm'],
>> >       context   => '/files/etc/php5/fpm/php.ini',
>> >       changes   => [
>> >         "set /PHP/error_log /var/log/php/php.log",
>> >       ],
>> >    }
>> >
>> > Does anyone have any idea why these aren't being saved?
>> >
>> > Thanks,
>> > Guy
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Puppet Users" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/puppet-users/-/nVj8fzqwEp8J.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>
>
> --
> Guy Knights
> Systems Administrator
> Eastside Games
> www.eastsidegamestudio.com
> [email protected]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to