Ask Your Question
0

Add extra value to a parameter in file

asked 2016-04-04 11:06:13 -0500

stanislas93 gravatar image

Hi,

With this configuration , I can add the parameter "exclude" in the yum.conf file if it does not exist with the value " kernel" .

augeas { yumexcludekernel: context => '/files/etc/yum.conf/main', changes => "set exclude 'kernel'" }

But, if there is already this parameter with a different value, it is overwritten...

My question is: how to add another value with a space between values ​​without overwrite the existing one ?

Is this possible with augeas ?

regards

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2016-04-05 03:10:52 -0500

I don't know whether this is possible with augeas. But you can also use inisubsetting (from inifile module).

edit flag offensive delete link more
0

answered 2016-04-05 10:12:35 -0500

stanislas93 gravatar image

Thanks a lot, this conf is good :

ini_subsetting {'kernel_exclude':
  path                  => '/etc/yum.conf',
  section               => 'main',
  setting               => 'exclude',
  subsetting            => 'kernel*',
  subsetting_separator  => ' ',
  ensure                => present,
}
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-04-04 11:06:13 -0500

Seen: 110 times

Last updated: Apr 05 '16