The augeas insert command is throwing an error if I specify a lens and incl in the resource. I haven't really been able to find anyone with a similar problem. When I include the following resource it throws unhelpful error that just says
$file = "/etc/ldap.conf"
$comment_style = "#comment"
$lens = "Spacevars.lns"
augeas { "${file}":
context => "/files${file}",
changes => [
"ins ${comment_style} before '*[1]'",
"set ${comment_style}[1] 'Puppet has modified this file with augeas'",
],
incl => "/files${file}",
lens => $lens,
}
I've tried the equivalent in augtool:
# augtool --noload --noautoload
augtool> set /augeas/load/Spacevars/lens "Spacevars.lns"
augtool> set /augeas/load/Spacevars/incl "/etc/ldap.conf"
augtool> load
augtool> ins #comment before /files/etc/ldap.conf/*[1]
augtool> set /files/etc/ldap.conf/#comment[1] 'Puppet has modified this file with augeas'
augtool> save
Saved 1 file(s)
I've found that without the insert command it works fine (although without the set command it breaks even in augtool complaining about a malformed child node). Puppet's error when running this with --debug.
Debug: Augeas[/etc/ldap.conf](provider=augeas): sending command 'ins' with params ["#comment", "before", "/files/etc/ldap.conf/*[1]"]
Debug: Augeas[/etc/ldap.conf](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Augeasdebug/Augeas[/etc/ldap.conf]: Could not evaluate: Error sending command 'ins' with params ["#comment", "before", "/files/etc/ldap.conf/*[1]"]/Error sending command 'ins' with params ["#comment", "before", "/files/etc/ldap.conf/*[1]"]
Without the lens and incl options it works fine, although I need to be able to specify these. I'm only just starting to use augeas, but I can't find that much relevant documentation using puppet with augeas. I had to guess the equivalent augtool commands.