Skip to content

Commit

Permalink
Handle tab-separated values better
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-larsson committed Dec 12, 2023
1 parent bbdddf0 commit 0179024
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
$qvalue = shellquote("${value}")
# lint:endignore
exec { "enforce-sysctl-value-${qtitle}":
unless => "test \"$(sysctl -n ${qtitle})\" = ${qvalue}",
unless => "test \"$(sysctl -n ${qtitle} | tr -s '[ \t]' ' ')\" = ${qvalue}",
command => "sysctl -w ${qtitle}=${qvalue}",
path => ['/usr/sbin', '/sbin', '/usr/bin', '/bin'],
}
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

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

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

0 comments on commit 0179024

Please sign in to comment.