I'd like to add a "this file managed by puppet" line to the top of the
files I manage with augeas.

This works but is not idempotent.  I could add an onlyif but then if I want
to change SELINUX to "off" I won't be able to, since the comment will
always exist.

augeas { 'selinux_config':
  context => '/files/etc/selinux/config',
  changes => [
    'ins #comment before #comment[1]',
    'set #comment[1] "TEST"',
    'set SELINUX on',
  ],
}


I I tried the following but get error "Error:
/Stage[main]/Test_module/Augeas[selinux_config]: Could not evaluate: Saving
failed, see debug"

If I remove the 'ins' line the comment is added and it's idempotent, but of
course the comment is at the bottom of the file.

augeas { 'selinux_config':
  context => '/files/etc/selinux/config',
  changes => [
    'ins #comment before #comment[1]',
    'set #comment[. = "TEST" ] "TEST"',
    'set SELINUX on',
  ],
}

Is there any way to get this to work or am I just beating my head against
the wall for nothing?
Thanks,

-- 
Kent Brede

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to