Using Puppet versions
Master: puppetserver 6.7
Client: puppet-agent 6.10
I have other Augeas code in other modules that works just fine.
Example sssd.conf
[sssd]
services = nss, sudo, pam, ssh
config_file_version = 2
domains = abc.def.net
[domain/abc.def.net]
cache_credentials = True
id_provider = ipa
auth_provider = ipa
access_provider = ipa
ipa_hostname = xxx.abc.def.net
...
I need to update/verify the ipa_hostname value in the [domain/abc.def.net] section. I can't figure out what I'm doing wrong with this augeas code
augeas { "sssd.conf":
context => "/files/etc/sssd/sssd.conf",
changes => [
"set ipa_hostname xxx",
],
notify => Service["sssd"]
}
Here is the debug output:
Debug: Augeas[sssd.conf](provider=augeas): Opening augeas with root /, lens path , flags 64
Debug: Augeas[sssd.conf](provider=augeas): Augeas version 1.12.0 is installed
Debug: Augeas[sssd.conf](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[sssd.conf](provider=augeas): sending command 'set' with params ["/files/etc/sssd/sssd.conf/ipa_hostname", "no"]
Debug: Augeas[sssd.conf](provider=augeas): Put failed on one or more files, output from /augeas//error:
Debug: Augeas[sssd.conf](provider=augeas): /augeas/files/etc/sssd/sssd.conf/error = put_failed
Debug: Augeas[sssd.conf](provider=augeas): /augeas/files/etc/sssd/sssd.conf/error/path = /files/etc/sssd/sssd.conf/
Debug: Augeas[sssd.conf](provider=augeas): /augeas/files/etc/sssd/sssd.conf/error/lens = /opt/puppetlabs/puppet/share/augeas/lenses/dist/sssd.aug:33.13-.53:
Debug: Augeas[sssd.conf](provider=augeas): /augeas/files/etc/sssd/sssd.conf/error/message = Failed to match tree under /
{ "target" = "sssd" }
{ "target" = "domain/test.hfgs.net" }
{ "target" = "nss" }
{ "target" = "pam" }
{ "target" = "sudo" }
{ "target" = "autofs" }
{ "target" = "ssh" }
{ "target" = "pac" }
{ "ipa_hostname" = "xxx" }
with pattern
( { /#comment/ = /[^\t\n\r ].*[^\t\n\r ]|[^\t\n\r ]/ }
| { })*
{ /target/ = /[^]\n\r]+/ }*
Debug: Augeas[sssd.conf](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Testaugeas/Augeas[sssd.conf]: Could not evaluate: Save failed, see debug output for details
Took a couple days but I finally figured this out. I added some extra code to show how to address another section in the same file. Hope this helps.