Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Puppet Augeas Plugin
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joel Nimety  
View profile  
 More options Oct 8 2008, 2:42 pm
From: Joel Nimety <jnim...@perimeterusa.com>
Date: Wed, 08 Oct 2008 14:42:37 -0400
Local: Wed, Oct 8 2008 2:42 pm
Subject: Puppet Augeas Plugin

Bryan -- I'm using the puppet augeas plugin at
http://git.et.redhat.com/?p=ace.git;a=blob;f=modules/augeas/plugins/p...

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
jnim...@perimeterusa.com
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

[ augeas.rb.patch < 1K ]
--- 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?)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joel Nimety  
View profile  
 More options Oct 9 2008, 9:34 am
From: Joel Nimety <jnim...@perimeterusa.com>
Date: Thu, 09 Oct 2008 09:34:45 -0400
Local: Thurs, Oct 9 2008 9:34 am
Subject: Puppet Augeas Plugin

resending, not sure the original made it to the mailing list.

Bryan -- I'm using the puppet augeas plugin at
http://git.et.redhat.com/?p=ace.git;a=blob;f=modules/augeas/plugins/p...

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
jnim...@perimeterusa.com
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

[ augeas.rb.patch < 1K ]
--- 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?)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bryan Kearney  
View profile  
 More options Oct 9 2008, 9:59 am
From: Bryan Kearney <bkear...@redhat.com>
Date: Thu, 09 Oct 2008 09:59:37 -0400
Local: Thurs, Oct 9 2008 9:59 am
Subject: Re: Puppet Augeas Plugin

Joel Nimety wrote:
> resending, not sure the original made it to the mailing list.

> Bryan -- I'm using the puppet augeas plugin at
> http://git.et.redhat.com/?p=ace.git;a=blob;f=modules/augeas/plugins/p...

> 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.

Thank you. I have applied this patch. Please let me know if it works for
you.

http://git.et.redhat.com/?p=ace.git;a=commit;h=8c4420ba7c732d039ce6a3...

-- bk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joel Nimety  
View profile  
 More options Oct 9 2008, 12:51 pm
From: Joel Nimety <jnim...@perimeterusa.com>
Date: Thu, 09 Oct 2008 12:51:46 -0400
Local: Thurs, Oct 9 2008 12:51 pm
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

Bryan Kearney wrote:
> Joel Nimety wrote:

> Thank you. I have applied this patch. Please let me know if it works for
> you.

> http://git.et.redhat.com/?p=ace.git;a=commit;h=8c4420ba7c732d039ce6a3...

> -- bk

hmmm. looks like a patch from Marc Fournier attempts to address the same
thing and I'm not sure both are necessary (and they conflict in some
cases).  I suppose it depends on what behavior is appropriate.

Marc's patch will not perform the onlyif get/match if the node doesn't
exist (when result.nil?).  My patch will still perform the get/match; my
thinking was that this would allow to test for the entry not being
present (onlyif => "Key =~ ''").

I'm not sure which approach results in a more intuitive behavior but
only one should be used. Thoughts?


--
Joel Nimety
Perimeter eSecurity
Product Architect, Email Defense
203.541.3416
jnim...@perimeterusa.com
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bryan Kearney  
View profile  
 More options Oct 9 2008, 1:51 pm
From: Bryan Kearney <bkear...@redhat.com>
Date: Thu, 09 Oct 2008 13:51:12 -0400
Local: Thurs, Oct 9 2008 1:51 pm
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

I put a test in there where, assuming no star wars characters exist in
the file this should run

augeas{"test_missing_node_should_run":
     require => Augeas[test_regex_2_should_not_run],
     context => "/files/etc/sysconfig/firstboot",
     changes => "set Boss Nass",
     onlyif => "get Boss != Nass ",

}

And this should not

augeas{"test_missing_node2_should_not_run":
     require => Augeas[test_regex_2_should_not_run],
     context => "/files/etc/sysconfig/firstboot",
     changes => "set Jango Fett",
     onlyif => "get Jango == Fett ",

}

So.. we basically say run if nil != Nass and do not run if nil == Fett.
This appears to be true. This seems logical to me. What it does not
allow for is the setting of value X if node Y is absent. But this can be
done with the following (again, first runs second will not)

augeas{"test_missing_node3_should_run":
     require => Augeas[test_regex_2_should_not_run],
     context => "/files/etc/sysconfig/firstboot",
     changes => "set Boba Fett",
     onlyif => "match Anakin size == 0",

}

augeas{"test_missing_node4_should_not_run":
     require => Augeas[test_regex_2_should_not_run],
     context => "/files/etc/sysconfig/firstboot",
     changes => "set Anakin Skywalker",
     onlyif => "match Boba size == 0",

}

-- bk

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bryan Kearney  
View profile  
 More options Oct 9 2008, 3:11 pm
From: Bryan Kearney <bkear...@redhat.com>
Date: Thu, 09 Oct 2008 15:11:10 -0400
Local: Thurs, Oct 9 2008 3:11 pm
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

I just noticed that the extra patch got in. I reverted it. The above
still holds. Marc.. does the above solve your use cases?

-- bk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Fournier  
View profile  
 More options Oct 16 2008, 3:14 pm
From: Marc Fournier <marc.fourn...@camptocamp.com>
Date: Thu, 16 Oct 2008 21:14:26 +0200
Local: Thurs, Oct 16 2008 3:14 pm
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

In fact my usual use case is
    changes => "set Boss Nass",
    onlyif => "get Boss != Nass ",
as a workaround for the issue discussed in this thread:
http://thread.gmane.org/gmane.comp.sysutils.augeas.devel/985/focus=9753

The patch I sent indeed focused on the need for this workaround. The
behaviour of Joel's patch is definitely better.

Thanks !
Marc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bryan Kearney  
View profile  
 More options Oct 16 2008, 8:16 pm
From: Bryan Kearney <bkear...@redhat.com>
Date: Thu, 16 Oct 2008 20:16:38 -0400
Local: Thurs, Oct 16 2008 8:16 pm
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

So.. to verify... you are good?

-- bk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Fournier  
View profile  
 More options Oct 17 2008, 2:45 am
From: Marc Fournier <marc.fourn...@camptocamp.com>
Date: Fri, 17 Oct 2008 08:45:56 +0200
Local: Fri, Oct 17 2008 2:45 am
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

>> The patch I sent indeed focused on the need for this workaround. The
>> behaviour of Joel's patch is definitely better.

> So.. to verify... you are good?

Sorry, I wasn't very clear. Yes Joel's patch works fine for me.

Marc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bryan Kearney  
View profile  
 More options Oct 17 2008, 8:32 am
From: Bryan Kearney <bkear...@redhat.com>
Date: Fri, 17 Oct 2008 08:32:13 -0400
Local: Fri, Oct 17 2008 8:32 am
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

Marc Fournier wrote:
>>> The patch I sent indeed focused on the need for this workaround. The
>>> behaviour of Joel's patch is definitely better.

>> So.. to verify... you are good?

> Sorry, I wasn't very clear. Yes Joel's patch works fine for me.

Great.. thank you for using it and sending along the patch!

-- bk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Lutterkort  
View profile  
 More options Oct 22 2008, 1:48 pm
From: David Lutterkort <lut...@redhat.com>
Date: Wed, 22 Oct 2008 10:48:09 -0700
Local: Wed, Oct 22 2008 1:48 pm
Subject: Re: [Puppet Users] Re: Puppet Augeas Plugin

On Thu, 2008-10-16 at 21:14 +0200, Marc Fournier wrote:
> In fact my usual use case is
>     changes => "set Boss Nass",
>     onlyif => "get Boss != Nass ",
> as a workaround for the issue discussed in this thread:
> http://thread.gmane.org/gmane.comp.sysutils.augeas.devel/985/focus=9753

> The patch I sent indeed focused on the need for this workaround. The
> behaviour of Joel's patch is definitely better.

I just released augeas-0.3.2, which does not need this workaround
anymore: the behavior is now that files are only touched if their actual
contents have changed, i.e. Augeas is now idempotent.

The list of files that was actually modified is now also available
at /augeas/events/saved ... that should make it easy to generate log
messages about what was changed, either at the level of tree nodes or
actual files.

David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »