Ask Your Question
0

what type of lens used for .conf type file in augeas?

asked 2016-02-02 23:56:42 -0500

yoga gravatar image

updated 2016-02-11 20:03:57 -0500

I want to change wrapper.conf file using augeas. So which lens is efficient for it. I tried it with Shellvars.lns but i got error like the following.

  print /augeas//error
  /augeas/files/opt/puppet-testing/testing/sample/sam/wrapper.conf/error = "parse_skel_failed"
  /augeas/files/opt/puppet-testing/testing/sample/sam/wrapper.conf/error/pos = "0"
  /augeas/files/opt/puppet-testing/testing/sample/sam/wrapper.conf/error/line = "1"
  /augeas/files/opt/puppet-testing/testing/sample/sam/wrapper.conf/error/char = "0"
  /augeas/files/opt/puppet-testing/testing/sample/sam/wrapper.conf/error/lens = "/usr/share/augeas/lenses/dist/shellvars.aug:179.12-.56:"
 /augeas/files/opt/puppet-testing/testing/sample/sam/wrapper.conf/error/message = "Syntax error"

my wrapper.conf like following.here i want to change the value of the keys.So which lens is efficient for it.

                 #encoding=UTF-8
                 # Configuration files must begin with a line specifying the encoding
                 #  of the the file.
                wrapper.check.deadlock=TRUE
                wrapper.check.deadlock.interval=60
                wrapper.check.deadlock.action=RESTART
                wrapper.check.deadlock.output=FULL

By using Simplevars

   augtool> set /augeas/load/Simplevars/lens Simplevars.lns
   augtool> set /augeas/load/Simplevars/incl /opt/puppet-testing/prodequ/conf/wrapper.conf
   augtool> load
   augtool> save
   augtool> set /files
   files
   augtool> set /files/opt/puppet-testing/prodequ/conf/wrapper.conf/wrapper.java.initmemory 1000
   augtool> save
   error: Failed to execute command
   saving failed (run 'print /augeas//error' for details)
   augtool> print /augeas//error
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error = "parse_skel_failed"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/pos = "11140"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/line = "282"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/char = "0"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/lens = "/usr/share/augeas/lenses  /dist/simplevars.aug:34.10-.46:"
    /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/message = "Iterated lens matched less than it should"
    augtool>

By using Shellvars

  [ ~]# augtool --noload --noautoload
   augtool> set /augeas/
   context    root       save       span       variables  version/   
   augtool> set /augeas/load/Shellvars/lens Shellvars.lns
   augtool> set /augeas/load/Shellvars/incl /opt/puppet-testing/prodequ/conf/wrapper.conf
   augtool> load
   augtool> save
   augtool> set /files/opt/puppet-testing/prodequ/conf/wrapper.conf/wrapper.java.initmemory 1000
   augtool> save
   error: Failed to execute command
   saving failed (run 'print /augeas//error' for details)
   augtool> print /augeas//error
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error = "parse_skel_failed"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/pos = "0"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/line = "1"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/char = "0"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/lens = "/usr/share/augeas/lenses/dist/shellvars.aug:179.12-.56:"
   /augeas/files/opt/puppet-testing/prodequ/conf/wrapper.conf/error/message = "Syntax error"
   augtool>
edit retag flag offensive close merge delete

Comments

You need to provide more information about what the file is and what you're trying to do.

Alex Harvey gravatar imageAlex Harvey ( 2016-02-03 02:42:00 -0500 )edit

I am trying to change the value of key in wrapper.conf file using augeas. i tried whith Shellvars.lns but i got wrapper.conf/error = "parse_skel_failed" error/pos = "0" error/line = "1" error/char = "0" lens = "/usr/share/augeas/lenses/dist/shellvars.aug:179.12-.56:" message = "Syntax error"

yoga gravatar imageyoga ( 2016-02-03 04:25:24 -0500 )edit

line1 of file is "#encoding=UTF-8 # Configuration files must begin with a line specifying the encoding"" 179 th line of lens " let lns = empty* . (comment | entry_eol | rec_entry) *" i thought that error may be in entry_eol. is Shellvars.lns suitable for wrapper.conf?or may i use which lens for it.

yoga gravatar imageyoga ( 2016-02-03 04:31:35 -0500 )edit

Can you update the question with the content of the wrapper.conf file and explain clearly what you are trying to change, and the error messages you get.

Alex Harvey gravatar imageAlex Harvey ( 2016-02-03 05:03:16 -0500 )edit

@yoga Is your wrapper.conf file really indented with many spaces or have you just copied it in here incorrectly? Obviously, augeas won't work if you have lots of leading spaces in your config file. Probably, your application won't work either.

Alex Harvey gravatar imageAlex Harvey ( 2016-02-11 20:58:43 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-02-03 07:23:39 -0500

I got it working using the Simplevars.lns:

# cat /tmp/foo.pp
augeas { 'wrapper':
  lens    => "Simplevars.lns",
  incl    => "/tmp/wrapper.conf",
  changes => ["set wrapper.check.deadlock FALSE"],
}

Then

# cat /tmp/wrapper.conf 
wrapper.check.deadlock=TRUE
wrapper.check.deadlock.interval=60
wrapper.check.deadlock.action=RESTART
wrapper.check.deadlock.output=FULL

and

# puppet apply /tmp/foo.pp
Notice: Compiled catalog for centos-66-x64.local in environment production in 0.04 seconds
Notice: /Stage[main]/Main/Augeas[wrapper]/returns: executed successfully
Notice: Finished catalog run in 0.05 seconds
edit flag offensive delete link more

Comments

I tried with Simplevars.lns also but i got same error.

yoga gravatar imageyoga ( 2016-02-04 03:21:49 -0500 )edit

Well, the code I provided works whereas it won't work with the Shellvars.lns. It's not possible that you got the same error exactly, so you might need to update the post with your new code & error.

Alex Harvey gravatar imageAlex Harvey ( 2016-02-04 07:54:05 -0500 )edit

I updated my code and error in post.

yoga gravatar imageyoga ( 2016-02-11 20:05:46 -0500 )edit
1

answered 2016-02-12 12:15:47 -0500

reidmv gravatar image

It looks like it would be possible to manage this file with puppetlabs/inifile.

ini_setting { 'wrapper.check.deadlock':
  ensure  => present,
  path    => '/tmp/wrapper.conf',
  section => '',
  setting => 'wrapper.check.deadlock',
  value   => 'FALSE',
}
edit flag offensive delete link more

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: 2016-02-02 23:56:42 -0500

Seen: 646 times

Last updated: Feb 12 '16