From 2d333d71d9492d861008fedaecfbeb93160d20e5 Mon Sep 17 00:00:00 2001 From: "James T. Lee" Date: Mon, 6 Jun 2016 23:50:02 -0400 Subject: [PATCH] Enforce exec should find sysctl, test from path On Gentoo, sysctl is in `/usr/sbin`, not `/sbin`, resulting in an error like: ``` Error: Could not find command '/sbin/sysctl' Error: /Stage[main]/Sysctl[vm.min_free_kbytes]/Exec[enforce-sysctl-value-vm.min_free_kbytes]/returns: change from notrun ``` Other `exec`s in this defined type use the path to find `sysctl`, so the enforce `exec` should as well. --- manifests/init.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 70e2ee5..3f193d2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -90,8 +90,9 @@ $qvalue = shellquote("${value}") # lint:endignore exec { "enforce-sysctl-value-${qtitle}": - unless => "/usr/bin/test \"$(/sbin/sysctl -n ${qtitle})\" = ${qvalue}", - command => "/sbin/sysctl -w ${qtitle}=${qvalue}", + unless => "test \"$(sysctl -n ${qtitle})\" = ${qvalue}", + command => "sysctl -w ${qtitle}=${qvalue}", + path => [ '/usr/sbin', '/sbin', '/usr/bin', '/bin' ], } }