[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] Re: puppet provder not executing

David Lutterkort <lutter redhat com>

* David Lutterkort <lutter redhat com> [2009-03-23 00:28-0400]:
> On Sun, 2009-03-22 at 22:43 -0400, Micah Anderson wrote:
> > Do I need to somehow first create the file? I tried adding a "ins
> > sympa before /files/etc/logrotate.d/*[1]" to the augeas line, which
> > results in the following debug difference:
> >
> > debug: Augeas[logrotate_sympa](provider=augeas): sending
> > command 'ins' with params ["sympa", "before",
> > "/files/etc/logrotate.d/sympa/rule/files/etc/logrotate.d/*[1]"]
> Something is wrong there - there's one/files/etc/logrotate.d too many
> in
> that path.
> > but no file created...
> >
> > I'm probably missing something obvious here?
> Nothing obvious; a few things you can try:
> (1) Is the provider able to make simple changes to existing files
> (like
> add an alias for localhost in /etc/hosts ?

I could be constructing my augeas resources wrong, I'm still quite new
at this. So to try and add an alias for localhost in /etc/hosts, I did
the following:

  augeas { "host foo":
    context => "/files/etc/hosts",
    changes => "set 1/alias foo"; 

I tried it without the context as well:

  augeas { "host foo":
    changes => "set /files/etc/hosts/1/alias foo";

Both of these resulted in no change, and this debug:

debug: Augeas[host foo](provider=augeas): Opening augeas with root /,
lens path , flags 0
debug: Augeas[host foo](provider=augeas): Augeas version 0.4.0 is
debug: Augeas[host foo](provider=augeas): Will attempt to save and only
run if files changed
debug: Augeas[host foo](provider=augeas): sending command 'set' with
params ["/files/etc/hosts/1/alias", "foo"]
debug: Augeas[host foo](provider=augeas): Skipping becuase no files were
debug: Augeas[host foo](provider=augeas): Closed the augeas connection

It looks right, but it doesn't seem to change anything. Using augtool, I
can make this change:

augtool> set /files/etc/hosts/1/alias foo
augtool> save
augtool> quit
# cat /etc/hosts                     localhost foo

> (2) make sure that /etc/logrotate.d exists and is writable. Augeas
> will
> _not_ create missing directories, but it should create new files
> without
> problems, assuming the user that is running Augeas is allowed to
> create
> the file - watch out for SELinux. For puppet, the effective user is

This is fine.

> (3) Try the equivalent of your Augeas resource in augtool (you can
> write
> autool commands into a file and then run them with 'augtool <
> commands.txt', I recommend doing that in a fake root in which you copy
> the relevant files from /etc - use the -r option for augtool to point
> it
> to that fake root. That should tell us if the problem is with the
> provider or Augeas itself.

This works fine:

# ls /etc/logrotate.d/sympa
ls: /etc/logrotate.d/sympa: No such file or directory
# augtool
augtool> set /files/etc/logrotate.d/sympa/rule/file /var/log/sympa/*.log
augtool> save
augtool> quit
# cat /etc/logrotate.d/sympa
/var/log/sympa/*.log {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]