fuel-library/deployment/puppet/sysctl/manifests/value.pp
Vladimir Kuklin 945ae2b897 Revert "Sync sysctl module to v0.0.4 from upstream"
Partial-bug: #1337415

This reverts commit 6587dca0e9.

Change-Id: I86d233e77ac8107f034a494a725fe6947fb94427
2014-07-03 16:23:07 +00:00

36 lines
814 B
Puppet

define sysctl::value (
$value,
$key = 'name'
) {
$array = split($value,'[\s\t]')
$val1 = inline_template("<%= @array.delete_if(&:empty?).flatten.join(\"\t\") %>")
$real_key = $key ? {
'name' => $name,
default => $key,
}
sysctl { $real_key :
val => $val1,
before => Exec["exec_sysctl_${real_key}"],
}
$command = $::kernel ? {
openbsd => "sysctl ${real_key}=\"${val1}\"",
default => "sysctl -w ${real_key}=\"${val1}\"",
}
$unless = $::kernel ? {
openbsd => "sysctl ${real_key} | grep -q '=${val1}\$'",
default => "sysctl ${real_key} | grep -q ' = ${val1}'",
}
exec { "exec_sysctl_${real_key}" :
command => $command,
unless => $unless,
require => Sysctl[$real_key],
path => ["/bin", "/sbin", "/usr/bin", "/usr/sbin"],
}
}