Ask Your Question
0

unable to change semmni value in puppet augeas

asked 2015-01-27 11:15:16 -0600

Chutki gravatar image

updated 2015-02-02 07:10:40 -0600

Hi,

I have tried manifests to do semaphores changes, please look at below

define sysctltest::sysctl_def($value) {
$key = $title
$context = "/files/etc/sysctl.conf"
   augeas { $key:
     #incl   => '/etc/sysctl.conf',
     #lens   => 'Sysctl.lns'
     context => $context,
     onlyif  => "get kernel.semmni < '$value'",
     changes => "set kernel.semmni '$value'",
   }
}

class sysctltest::sample {
 $test = hiera_hash('sysctl_file2::systest')
 create_resources('sysctltest::sysctl_def',$test)
}

1)YAML file

sysctl_file2::systest:
  kernel.semmni:
    value: 5121004

output:

   +kernel.semmni = 512001

2)YAML file

sysctl_file2::systest:
  kernel.sem:
    value: 10240 512001 64 9005

ouput

+kernel.semmni = 10240 512001 64 9005

I also tried below options in manifests but none of the manifests worked out :(

onlyif  => "get kernel.sem < '$value'",
changes => "set kernel.sem '$value'",

onlyif  => "get kernel.sem[2] < '$value'",
changes => "set kernel.sem[2] '$value'",

got below output

+kernel.sem = 10240 512001 64 9005

tried to change tree structure

onlyif  => "get kernel.sem/2 < '$value'",
changes => "set kernel.sem/2 '$value'",

getting error message

Debug: Augeas[kernel.semmni](provider=augeas): Opening augeas with root /, lens path , flags 32
Debug: Augeas[kernel.semmni](provider=augeas): Augeas version 1.1.0 is installed
Debug: Augeas[kernel.semmni](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[kernel.semmni](provider=augeas): sending command 'set' with params ["/files/etc/sysctl.conf/kernel.sem/2", "10240 512001 64 9005"]
Debug: Augeas[kernel.semmni](provider=augeas): Put failed on one or more files, output from /augeas//error:
Debug: Augeas[kernel.semmni](provider=augeas): /augeas/files/etc/sysctl.conf/error = put_failed
Debug: Augeas[kernel.semmni](provider=augeas): /augeas/files/etc/sysctl.conf/error/path = /files/etc/sysctl.conf
Debug: Augeas[kernel.semmni](provider=augeas): /augeas/files/etc/sysctl.conf/error/lens = /opt/puppet/share/augeas/lenses/dist/sysctl.aug:37.10-.52:
Debug: Augeas[kernel.semmni](provider=augeas): /augeas/files/etc/sysctl.conf/error/message = Malformed child node 'kernel.sem'
Debug: Augeas[kernel.semmni](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Sysctltest::Sample/Sysctltest::Sysctl_def[kernel.semmni]/Augeas[kernel.semmni]: Could not evaluate: Saving failed, see debug

my reqirement is want to replace 2nd column seemmni value if the value is lesser than the given

so if given value = 512214

actual is

kernel.sem = 10240 **512001** 64 9005

want to change

kernel.sem = 10240 **512214** 64 9005
edit retag flag offensive close merge delete

Comments

Is there any update on this. Please help me I am working this same issue more than two days.

Chutki gravatar imageChutki ( 2015-01-28 10:34:21 -0600 )edit

Please post the exact error message that you receive from puppet.

GregLarkin gravatar imageGregLarkin ( 2015-01-28 20:26:05 -0600 )edit

Greg, I posted my doubt in the question tag since comment has limited character

Chutki gravatar imageChutki ( 2015-02-01 11:04:16 -0600 )edit

is there any update. I have edited my question

Chutki gravatar imageChutki ( 2015-02-02 07:11:13 -0600 )edit

Hi there, I'm still working on this, and it's a bit tricky, so I understand your difficulty. I'll post a follow-up as soon as I have an idea.

GregLarkin gravatar imageGregLarkin ( 2015-02-03 02:57:10 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-02-10 16:18:05 -0600

How about using https://forge.puppetlabs.com/hercules... instead? It will take care of calling both Augeas and sysctl.

edit flag offensive delete link more

Comments

Raphink, I don't think augeas sysctl provider would solve the issue, Since I compare the semmni value. I tried "set kernel.sem/01 $value" but I am getting.

Chutki gravatar imageChutki ( 2015-02-12 09:51:58 -0600 )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-27 11:15:16 -0600

Seen: 333 times

Last updated: Feb 10 '15