0

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

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

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这里看到...

4

1 回答 1

1

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

于 2016-07-06T07:31:03.350 回答