From 4163292df2995a584072eeb8b636bfc0432281ea Mon Sep 17 00:00:00 2001 From: Pierfrancesco A Date: Mon, 9 Apr 2018 15:29:25 +0200 Subject: [PATCH] Updated init.pp with simplified management of paths. Using a resource Default. --- manifests/init.pp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 70e2ee5..a6da490 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 { @@ -68,7 +73,6 @@ # 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}"], } @@ -76,7 +80,6 @@ # 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", } @@ -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}", } }