2009/9/10 David Lutterkort <lut...@redhat.com>: > Comments for most files[1] show up as nodes with label '#comment' and a > value that contains the comment without the leading '#[ \t]*'. > Therefore, to add a comment, you need to first create a '#comment' node > and then set it to whatever you want the comment to be.
Many thanks David - works perfectly! I can also understand where my thinking was wrong. For anyone googling this, here's a working example: node default { sysctl::config { "fs.file-max": value => 65536, comment => "Maximum number of filehandles", } } class sysctl { define config ($value, $comment) { file { "/etc/sysctl.conf": mode => 644, owner => root, group => root, ensure => present, } augeas { "sysctl_$name": context => "/files/etc/sysctl.conf", changes => [ "set $name $value", "insert #comment before $name", "set #comment[last()] '$comment'" ], onlyif => "get $name != $value", notify => Exec["/sbin/sysctl -p"], } exec { "/sbin/sysctl -p": subscribe => File["/etc/sysctl.conf"], refreshonly => true, } } } Cheers, Bryan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---