Bug #5211

Augeas resource type match size != operator does not work properly

Added by Steve Nielsen over 1 year ago. Updated 11 months ago.

Status:Closed Start date:11/05/2010
Priority:High Due date:
Assignee:- % Done:

0%

Category:augeas
Target version:2.7.0
Affected Puppet version:2.6.2 Branch:https://github.com/bkearney/puppet/tree/ticket/2.6.2/5211
Keywords:communitypatch
Votes: 1

Description

The ‘!=’ comparator in the Augeas resource type (specifically with onlyif match size) does not work properly in puppet due to the underlying Ruby interpreter not supporting ‘!=’ with send. Here is thread discussing the ruby issue: http://www.ruby-forum.com/topic/174382. The thread seems to indicate that Ruby versions greater than 1.9 support it ‘!=’ with send but I have not tested this.

I am using puppet 2.6.2 with ruby 1.8.5 on CentOS 5.5.

Puppet code that illustrates the problem:

augeas {
  "grub":
    context => "/files/etc/grub.conf",
    onlyif => "match timeout[.='30'] size != 1",
    changes => [
      "rm timeout",
      "ins timeout before title[1]",
      "set timeout 30",
    ],
}

With the code snippet above, puppet will execute the augeas statements on every run despite “timeout 30” line being present in the grub.conf file.

Attached is a patch against puppet 2.6.2.

I also notice there are no debug() statements in process_match(). Might be useful to have a couple statements in there to at least indicate that the onlyif/match statement is being processed.

I think this issue should be fixed sooner than later because it makes it that much harder and frustrating to debug the augeas resource type when the underlying implementation does not work.

Thanks, Steve

augeas-onlyif-match-size.patch (656 Bytes) Steve Nielsen, 11/05/2010 11:26 pm

History

Updated by Steve Nielsen over 1 year ago

Here is some ruby code that shows the ‘!=’ issue with send. Meant to include in original report.

puts ["1","2"].size.send(:==, 1)
puts ["1","2"].size.send(:>, 1)
puts ["1","2"].size.send(:<, 1)
puts ["1","2"].size.send(:!=, 1) # <-- generates syntax error

Updated by Nigel Kersten over 1 year ago

  • Status changed from Unreviewed to Needs More Information
  • Assignee set to Nigel Kersten

Thanks Steve. Do you want me to send the patch onto the -dev list for you? Or would you like to get started with our development process?

http://projects.puppetlabs.com/projects/puppet/wiki/Development_Development_Lifecycle

I don’t mind doing it, but we’re also trying to encourage people to work through that process as we’ve streamlined it a lot.

Updated by Steve Nielsen over 1 year ago

I would like to get started with your development process. I will read the link you provided.

Thanks, Steve

Updated by Nigel Kersten over 1 year ago

  • Status changed from Needs More Information to Accepted

Awesome to hear Steve.

Updated by James Turnbull over 1 year ago

Bryan – just wanted to point you at this one.

Updated by James Turnbull over 1 year ago

Bryan – just wanted to make you aware of this.

Updated by Bryan Kearney over 1 year ago

Sent a pull request for this:

https://github.com/bkearney/puppet/commit/e847d33390ae3cc6cb75c2c2183c3fab0d199c02

Updated by Bryan Kearney over 1 year ago

  • Status changed from Accepted to Ready For Checkin

Updated by James Turnbull over 1 year ago

  • Target version set to 2.7.x

Updated by James Turnbull over 1 year ago

  • Branch set to https://github.com/bkearney/puppet/tree/ticket/2.6.2/5211

Updated by Matt Robinson over 1 year ago

  • Status changed from Ready For Checkin to In Topic Branch Pending Review
  • Keywords set to communitypatch

Updated by Matt Robinson over 1 year ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release
  • Assignee deleted (Nigel Kersten)

commit:ab7de670a13eff599b6b725513fcb8a67e12136b

Updated by Paul Berry over 1 year ago

  • Status changed from Merged - Pending Release to Closed

Merged into master as of commit:a2ff092d8302e09aa79f9bb16636f8298316c3c7 (12/15/2010)

Updated by James Turnbull 11 months ago

  • Target version changed from 2.7.x to 2.7.0

Also available in: Atom PDF