0

I want to manage the contents of the carbon.conf file using Augeas from Puppet. I have used Augeas before in Puppet for managing an xml file and that worked great.

However this time when the puppet catalog is applied, nothing happens to the carbon.conf file. There is also no error in the log. Here's my code in the puppet manifest file:

augeas { 'cache config':
  notify  => Service[carbon-cache],
  incl    => '/opt/graphite/conf/carbon.conf',
  context => '/cache',
  lens    => 'Carbon.lns',
  changes => [
    "set UDP_RECEIVER_PORT 2013",
    "set LINE_RECEIVER_PORT 2013",
    "set PICKLE_RECEIVER_PORT 2014",
  ];
}

And in the debug log I can see the following:

Debug: Augeas[cache config](provider=augeas): Opening augeas with root /, lens path /var/lib/puppet/lib/augeas/lenses, flags 64
Debug: Augeas[cache config](provider=augeas): Augeas version 1.0.0 is installed
Debug: Augeas[cache config](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[cache config](provider=augeas): sending command 'set' with params ["/cache/UDP_RECEIVER_PORT", "2013"]
Debug: Augeas[cache config](provider=augeas): sending command 'set' with params ["/cache/LINE_RECEIVER_PORT", "2013"]
Debug: Augeas[cache config](provider=augeas): sending command 'set' with params ["/cache/PICKLE_RECEIVER_PORT", "2014"]
Debug: Augeas[cache config](provider=augeas): Skipping because no files were changed
Debug: Augeas[cache config](provider=augeas): Closed the augeas connection

What am I missing here?

I also noticed that when using augtool from the command line the ls /files/ command only lists the following folders

augtool> ls /files/
etc/ = (none)
usr/ = (none)
boot/ = (none)

I would also expect to see /opt here...

Harm Doedens
  • 35
  • 1
  • 8

1 Answers1

1

Context needs to contain the full path to the base node you want for relative paths. In your case, I'm guessing you want context to be /files/opt/graphite/conf/carbon.conf/cache

raphink
  • 3,625
  • 1
  • 28
  • 39
  • Thanks, I guess I did not quite understand the puppet reference docs for context parameter correctly `Optional context path. This value is prepended to the paths of all changes if the path is relative. If the incl parameter is set, defaults to /files + incl; otherwise, defaults to the empty string.` – Harm Doedens Jul 06 '16 at 08:58
  • In general in Augeas, a path that starts with `/` is absolute, so `/cache` is most certainly not what you want to use. – raphink Jul 06 '16 at 09:12