Bryan -- I'm using the puppet augeas plugin at http://git.et.redhat.com/?p=ace.git;a=blob;f=modules/augeas/plugins/puppet/type/augeas.rb;h=2346c37d724d7607ed4e09b0413700bec2b7cbed;hb=HEAD
I'm running into a behavior that I wouldn't expect. I'd like to confirm an entry in sysctl.conf by changing the value if necessary or appending the key/value if it doesn't exist in the file. This seems like a common scenario. However, the following example does not add net.ipv4.tcp_max_syn_backlog if it doesn't already exist in sysctl.conf. class sysctl { file { "sysctl_conf": name => $operatingsystem ? { default => "/etc/sysctl.conf" }, } config { "net.ipv4.tcp_max_syn_backlog": ensure => 4096 } exec { "sysctl -p": alias => "sysctl", refreshonly => true, subscribe => File["sysctl_conf"], } } define sysctl::config ($ensure) { augeas { "sysctl_conf_$name": notify => Exec["sysctl"], context => "/files/etc/sysctl.conf", changes => "set $name $ensure", onlyif => "get $name != $ensure" } } poking around in augeas.rb I noticed that "onlyif" is only processed if the result is not nil. Is this intended behavior? I propose that if the return value is nil it should be treated as an empty string so comparisons can still happen, I've attached a patch if this suits you. -- Joel Nimety Perimeter eSecurity Product Architect, Email Defense 203.541.3416 [EMAIL PROTECTED] http://www.perimeterusa.com -- The sender of this email subscribes to Perimeter eSecurity's email anti-virus service. This email has been scanned for malicious code and is believed to be virus free. For more information on email security please visit: http://www.perimeterusa.com/email-defense-content.html This communication is confidential, intended only for the named recipient(s) above and may contain trade secrets or other information that is exempt from disclosure under applicable law. Any use, dissemination, distribution or copying of this communication by anyone other than the named recipient(s) is strictly prohibited. If you have received this communication in error, please delete the email and immediately notify our Command Center at 203-541-3444. Thanks --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
--- augeas.rb.old 2008-10-08 14:33:55.000000000 -0400 +++ augeas.rb 2008-10-08 14:37:16.000000000 -0400 @@ -180,7 +180,7 @@ #check the value in augeas aug = open_augeas() - result = aug.get(path) + result = aug.get(path) || '' unless result.nil? case comparator when "!=": @@ -208,7 +208,7 @@ #Get the values from augeas aug = open_augeas() - result = aug.match(path) + result = aug.match(path) || '' # Now do the work if (!result.nil?)