Skip to content

Commit d37daa5

Browse files
Merge pull request #3 from kodguru/handle_tabs_values
Handle tab-separated values better
2 parents bbdddf0 + 0179024 commit d37daa5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
$qvalue = shellquote("${value}")
101101
# lint:endignore
102102
exec { "enforce-sysctl-value-${qtitle}":
103-
unless => "test \"$(sysctl -n ${qtitle})\" = ${qvalue}",
103+
unless => "test \"$(sysctl -n ${qtitle} | tr -s '[ \t]' ' ')\" = ${qvalue}",
104104
command => "sysctl -w ${qtitle}=${qvalue}",
105105
path => ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],
106106
}

spec/defines/init_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
it do
6161
is_expected.to contain_exec('enforce-sysctl-value-net.ipv4.ip_forward').only_with(
62-
unless: 'test "$(sysctl -n net.ipv4.ip_forward)" = ""',
62+
unless: "test \"$(sysctl -n net.ipv4.ip_forward | tr -s '[ \t]' ' ')\" = \"\"",
6363
command: 'sysctl -w net.ipv4.ip_forward=""',
6464
path: ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],
6565
)
@@ -99,7 +99,7 @@
9999

100100
it do
101101
is_expected.to contain_exec('enforce-sysctl-value-net.ipv4.ip_forward').only_with(
102-
unless: 'test "$(sysctl -n net.ipv4.ip_forward)" = 1',
102+
unless: "test \"$(sysctl -n net.ipv4.ip_forward | tr -s '[ \t]' ' ')\" = 1",
103103
command: 'sysctl -w net.ipv4.ip_forward=1',
104104
path: ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],
105105
)

0 commit comments

Comments
 (0)