Ask Your Question
0

failed match error in augeas

asked 2015-01-09 08:16:53 -0500

Chutki gravatar image

Hi

I am doing sample test with simplelines.lns

below is my file

test test1
test test2
test test3

below is my manifests

class testfile::testfile1 {
augeas { "testfile":
    lens    => 'Simplelines.lns',
    incl    => '/tmp/testfile',
    changes =>  "set 1/test/test1 test5",

 }
}

but I am getting error

Put failed on one or more files, output from /augeas//error:
Debug: Augeas[testfile](provider=augeas): /augeas/files/tmp/testfile/error = put_failed
Debug: Augeas[testfile](provider=augeas): /augeas/files/tmp/testfile/error/path = /files/tmp/testfile/1
Debug: Augeas[testfile](provider=augeas): /augeas/files/tmp/testfile/error/lens = /opt/puppet/share/augeas/lenses/dist/simplelines.aug:28.8-29.32:
Debug: Augeas[testfile](provider=augeas): /augeas/files/tmp/testfile/error/message = Failed to match

  with tree
    { "test" }stfile::Testfile1/Augeas[testfile]: Could not evaluate: Saving failed, see debug 


Debug: Augeas[testfile](provider=augeas): Closed the augeas connection
Error: /Stage[main]/TeI all the below options to replace "test test1" to "test test5"

what I want is, to replace "test test1" to "test test5"

changes =>  ["set 1/test test1",
                 "set 1/test/test1 test5",]

    changes =>  ["set 1/test test1",
                 "set 1/test/test1[1] test5",]

but still getting same error.

Also I tried to add an entry after test1 "test test1" to "test test1 test5"

changes =>  [ "set 1/test[1] test1",
              "set 1/test[2] test5"  ]

changes => ["set 1 test",
            "set 1/test test1",
        "set 1/test/test1 tes5"]

But none of my manifests got compiled. I am getting one or the other error.

I had look at /usr/share/augeas/simpleline.lns, my understanding it could just replace like

changes => ["set 1 test5",
            "set 2 tes6"]

the file change like

test5 
test6 
test test3

I dont find anything releated to append file for simplelines.lns like with alias[3].(Please correct me if my understaning is wrong). Please help me out why I am getting error.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-01-09 08:30:13 -0500

domcleal gravatar image

Do:

changes => 'set 1 "test test5"'

This changes line 1 to the value "test test5". If you need something else, please say precisely, as the question appears obfuscated.

edit flag offensive delete link more

Comments

I wanna do two test cases 1) need to replace test1 to test5 (in line one, column two) from "test test1" to "test test5" need to edit only column two 2) wanna insert new value in column i.e, "test test1" to "test test1 test5". These wanna achieve in augeas. .Just testing for my learning purpose.

Chutki gravatar imageChutki ( 2015-01-10 11:30:23 -0500 )edit

Hi Domcleal, Is there any update on this. I am waiting for your response.

Chutki gravatar imageChutki ( 2015-01-19 11:31:17 -0500 )edit

I think you'd have to develop your own lens then to represent this file format, then you could set individual columns.

domcleal gravatar imagedomcleal ( 2015-01-20 02:45:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-01-09 08:16:53 -0500

Seen: 1,297 times

Last updated: Jan 09 '15