Augeas 任务显示已更改,但文件并未更改

Augeas 任务显示已更改,但文件并未更改

我已经安装了 puppet-dashboard,并注意到我的所有 augeas 任务都显示为“已更改”。我希望 augeas 会自动检查是否要设置该值已经设置,在这种情况下不会执行任何操作。

我的食谱:

$puppet_conf = "/etc/puppet/puppet.conf"
file { "${puppet_conf}": }

augeas { "puppet_conf":
        context => "/files/${puppet_conf}/",
        changes => [
                "set agent/report true",
        ],
        require => File["${puppet_conf}"],
}

当值已经设置好时正常运行:

info: Applying configuration version '1363882751'
debug: Augeas[puppet_conf](provider=augeas): Opening augeas with root /, lens path , flags 0
debug: Augeas[puppet_conf](provider=augeas): Closed the augeas connection
debug: Augeas[puppet_conf](provider=augeas): Opening augeas with root /, lens path , flags 0
debug: Augeas[puppet_conf](provider=augeas): sending command 'set' with params ["/files//etc/puppet/puppet.conf/agent/report", "true"]
debug: Augeas[puppet_conf](provider=augeas): Closed the augeas connection
notice: /Stage[main]/Puppet_agent/Augeas[puppet_conf]/returns: executed successfully

文件的日期/时间没有改变,所以显然它没有改变文件。但是,puppet-dashboard 显示文件为“已更改”。如果我输入“onlyif”,该部分将不会显示,但我不想在 onlyif 中重复所有内容,而且我一次只能设置一个配置选项。

Debian Squeeze
Puppet 2.6.2
Augeas 0.10.0

配置这个的正确方法是什么?

答案1

感谢提供版本信息。看来你遇到了 Puppet 错误#11414,这是由于新的 Augeas 0.10.0 和旧版本的 Puppet 的结合造成的。

Puppet 中的提供程序误解了 Augeas 版本号为非常旧的版本(字符串而不是正确的版本比较),因此无法按预期工作。

您需要使用 Puppet 2.7.18squeeze-backports(或者Puppet 实验室仓库) 修复了此错误,或者使用 Augeas 的旧版本或新版本(1.0.0 或 0.9.0)。

相关内容