From 78c74eed3c7d943e4f496f462634c0c63bbcd291 Mon Sep 17 00:00:00 2001 From: schlitzered Date: Fri, 26 Feb 2021 10:58:32 +0100 Subject: [PATCH 1/2] Update init.pp Some sysctl values return "tabs", this breakes the test for changes, since there is no sane way to specify tabs in the target value. this change converts tabs in the output of sysctl -n to two spaces. resolving this issue of false positive change detection --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 70e2ee5..5f606e7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -90,7 +90,7 @@ $qvalue = shellquote("${value}") # lint:endignore exec { "enforce-sysctl-value-${qtitle}": - unless => "/usr/bin/test \"$(/sbin/sysctl -n ${qtitle})\" = ${qvalue}", + unless => "/usr/bin/test \"$(/sbin/sysctl -n ${qtitle} | sed -e 's/\t/ /g')\" = ${qvalue}", command => "/sbin/sysctl -w ${qtitle}=${qvalue}", } } From 50ecc060e5662f1800ff6ef334fba1e2ba1238b5 Mon Sep 17 00:00:00 2001 From: Brian Schonecker Date: Thu, 23 Jun 2022 10:48:05 -0400 Subject: [PATCH 2/2] Change SED substitution of TAB to one space instead of two to handle more kernel settings. --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 5f606e7..f9add67 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -90,7 +90,7 @@ $qvalue = shellquote("${value}") # lint:endignore exec { "enforce-sysctl-value-${qtitle}": - unless => "/usr/bin/test \"$(/sbin/sysctl -n ${qtitle} | sed -e 's/\t/ /g')\" = ${qvalue}", + unless => "/usr/bin/test \"$(/sbin/sysctl -n ${qtitle} | sed -e 's/\t/ /g')\" = ${qvalue}", command => "/sbin/sysctl -w ${qtitle}=${qvalue}", } }