augeas in puppet does not change file

眉间皱痕 提交于 2019-12-25 07:16:50

问题


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


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



来源:https://stackoverflow.com/questions/38218350/augeas-in-puppet-does-not-change-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!