Bug #1948

augeas ins bug: wrong number of arguments (1 for 3)

Added by John A. Barbuto over 1 year ago. Updated over 1 year ago.

Status:Closed Start:02/10/2009
Priority:Normal Due date:
Assignee:Bryan Kearney % Done:

0%

Category:-
Target version:0.24.8
Affected version:0.24.7 Branch:
Keywords:
Votes: 0

Description

Hi,

We were trying to use augeas to insert a line into /etc/pam.d/sshd (which needs to go in a specific place):

augeas { "pam.d/sshd":
        context => "/files/etc/pam.d/sshd",
        changes => [
            "ins 100 before 1",
            "set 100/type auth",
            "set 100/control sufficient",
            "set 100/module pam_radius_auth.so",
        ],
        onlyif  => "get 1/module != pam_radius_auth.so",
}

It kept returning this error:

Error sending command 'ins' with params ["/files/etc/pam.d/sshd/100", "before 1"]/wrong number of arguments (1 for 3)

I looked at the puppet code and determined the problem was due to not passing the correct arguments to the ins command, as described here by augtool:

 ins 

I’ll be submitting a patch for this shortly.

0001-Fixed-1948-pass-correct-arguments-to-ins-command.patch (1.6 KB) John A. Barbuto, 02/10/2009 01:24 am

0001-Added-patch-by-jab-to-support-the-correct-ins-syntax.patch (5.2 KB) Bryan Kearney, 02/12/2009 02:52 pm

0001-augeas-type-ins-doc-fix.patch (1004 Bytes) John A. Barbuto, 02/13/2009 10:06 pm


Related issues

duplicated by Puppet - Bug #1953: augeas type's ins support is broken Duplicate 02/10/2009

History

Updated by John A. Barbuto over 1 year ago

Patch against branch 0.24.x attached.

Updated by James Turnbull over 1 year ago

  • Status changed from Unreviewed to Ready for Testing
  • Assignee set to Bryan Kearney
  • Target version set to 0.24.8

Bryan?

Updated by Pietro Ferrari over 1 year ago

i tested the patch and it works

Updated by Bryan Kearney over 1 year ago

I took the pacth and added it into the my fork on github for both master and 0.24.x. Pull requests haven been sent to james. If you would like to see the current version:

http://github.com/bkearney/puppet/tree/1948-0.24.x http://github.com/bkearney/puppet/tree/1948-master

The amended patch file is attached.

Jab: Thank you for the patch. I did not have have you full email address to add to the comment.

Updated by James Turnbull over 1 year ago

  • Status changed from Ready for Testing to Closed

Pushed in commit:“cc4d6586d420f4beea1eeef85cfe7a28f8e493ac” in branch 0.24.x

Updated by micah - over 1 year ago

I’ve tested this patch in our environment, and it works good.

The patch in 1953 doesn’t look so good.

Updated by Jonathan Booth over 1 year ago

Patch doesn’t work for me. Patch doesn’t include any changes to parse_commands(), so # of arguments sent is always < 3, so cmd_array [ 2 ] == nil. I’ll provide a re-patch tomorrow.

Updated by Bryan Kearney over 1 year ago

I added new commits onto my branches. New version fixes the issue.

Updated by Jonathan Booth over 1 year ago

Can confirm new version fixes it for me.

debug: Augeassudo-vhost-lampdev.ed: Opening augeas with root /, lens path , flags 0 debug: Augeassudo-vhost-lampdev.ed: sending command ‘ins’ with params [“comment”, “after”, “/files/etc/sudoers/comment[last()]”] debug: Augeassudo-vhost-lampdev.ed: sending command ‘set’ with params [“/files/etc/sudoers/comment[last()]”, “start of sudo-vhost-lampdev.ed rules”]

Thanks!

Updated by John A. Barbuto over 1 year ago

The type/augeas.rb file also needs patching, as it was in jbooth’s patch.

Updated by James Turnbull over 1 year ago

Pushed in commit:“2561c8e252dcf66890513458750bb1329a03beec” in branch 0.24.x

Also available in: Atom PDF