我需要编辑/etc/mongodb.conf 中的一行
auth = true
Augas有一个mongo镜头,但它只适用于大于1.0 的Augas
我完全被augeas 0.9卡住了,因为它是epel repo中的最新版本,我无法从github编译augeas。
作为一个变通方案,我正在尝试编写我自己的augeas镜头,它将在augeas 0.9 上工作
到目前为止,我只有这个
module Spencer =
autoload xfm
let entry = key /[a-z]+/ . del /[ t]*=[ t]*/ "=" . store /[a-z]+/
let lns = [ entry . del "n" "n" ] *
test lns get "auth = falsenfoo = barn" = ?
let filter = incl "/etc/mongodb.conf"
let xfm = transform lns filter
当我尝试使用木偶类型将镜头应用于/etc/mongodb.conf时,我会得到一个错误"迭代镜头匹配得比它应该匹配的少"。
puppet apply augmongo.pp --debug --verbose --summarize
Info: Applying configuration version '1385024927'
Debug: Augeas[auth-mongo](provider=augeas): Opening augeas with root /, lens path , flags 64
Debug: Augeas[auth-mongo](provider=augeas): Augeas version 0.9.0 is installed
Test result: /usr/share/augeas/lenses/dist/spencer.aug:8.0-.44:
{ "auth" = "false" }
{ "foo" = "bar" }
Debug: Augeas[auth-mongo](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[auth-mongo](provider=augeas): sending command 'set' with params ["/files/etc/mongodb.conf/auth", "true"]
Debug: Augeas[auth-mongo](provider=augeas): Put failed on one or more files, output from /augeas//error:
Debug: Augeas[auth-mongo](provider=augeas): /augeas/files/etc/mongodb.conf/error = put_failed
Debug: Augeas[auth-mongo](provider=augeas): /augeas/files/etc/mongodb.conf/error/pos = 1
Debug: Augeas[auth-mongo](provider=augeas): /augeas/files/etc/mongodb.conf/error/lens = /usr/share/augeas/lenses/dist/spencer.aug:6.10-.37:
Debug: Augeas[auth-mongo](provider=augeas): /augeas/files/etc/mongodb.conf/error/message = Iterated lens matched less than it should
Debug: Augeas[auth-mongo](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Augmongo/Augeas[auth-mongo]: Could not evaluate: Save failed with return code false, see debug
Debug: Finishing transaction 69857417180740
Debug: Storing state
Debug: Stored state in 0.13 seconds
这个镜头怎么了
我如何从命令行测试镜头,并将木偶从等式中删除?
RHEL 6.4刚刚升级到Augas 1.0。看见https://rhn.redhat.com/errata/RHSA-2013-1537.html.
您应该能够重新构建程序包,或者等待CentOS为您执行此操作。
我在augeas&木偶应用更改似乎每次都以错误Could not evaluate: Save failed with return code false
结束。结果发现这是一个语法问题。我有:
set spec[user = '%somegroup']/host_group/command/tag NOPASSWD
(注意tag
和NOPASSWD
之间有两个空格)。当我在一个空白处尝试相同的命令时,问题就解决了。查看模板/镜头(spencer.au,第6.10-.37行)可能会发现问题所在。