Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
) {

include '::sysctl::base'

# to symplify the management of paths
Exec {
path => [ '/usr/sbin', '/sbin', '/usr/bin', '/bin' ],
}

# If we have a prefix, then add the dash to it
if $prefix {
Expand Down Expand Up @@ -68,15 +73,13 @@
# The immediate change + re-check on each run "just in case"
exec { "sysctl-${title}":
command => "sysctl -p /etc/sysctl.d/${sysctl_d_file}",
path => [ '/usr/sbin', '/sbin', '/usr/bin', '/bin' ],
refreshonly => true,
require => File["/etc/sysctl.d/${sysctl_d_file}"],
}

# For the few original values from the main file
exec { "update-sysctl.conf-${title}":
command => "sed -i -e 's#^${title} *=.*#${title} = ${value}#' /etc/sysctl.conf",
path => [ '/usr/sbin', '/sbin', '/usr/bin', '/bin' ],
refreshonly => true,
onlyif => "grep -E '^${title} *=' /etc/sysctl.conf",
}
Expand All @@ -91,7 +94,7 @@
# lint:endignore
exec { "enforce-sysctl-value-${qtitle}":
unless => "/usr/bin/test \"$(/sbin/sysctl -n ${qtitle})\" = ${qvalue}",
command => "/sbin/sysctl -w ${qtitle}=${qvalue}",
command => "sysctl -w ${qtitle}=${qvalue}",
}
}

Expand Down