人偶中的 augeas 不更改文件

augeas in puppet does not change file

我想使用 Puppet 中的 Augeas 管理 carbon.conf 文件的内容。我之前在 Puppet 中使用过 Augeas 来管理 xml 文件并且效果很好。

但是这次应用 puppet 目录时,carbon.conf 文件没有任何变化。日志中也没有错误。 这是我在人偶清单文件中的代码:

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",
  ];
}

在调试日志中我可以看到以下内容:

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

我在这里错过了什么?

我还注意到,当从命令行使用 augtool 时,ls /files/ 命令仅列出以下文件夹

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

我也希望在这里看到 /opt...

上下文需要包含相对路径所需的基本节点的完整路径。在您的情况下,我猜您希望上下文为 /files/opt/graphite/conf/carbon.conf/cache