Skip to content

Commit

Permalink
Check for multiple occurrences
Browse files Browse the repository at this point in the history
All occurrences of the sysctl settings must have the correct value.
It isn't enough to have one correct entry to pass. If there are
multiple entries and one of them has incorrect value we need to
fail.
  • Loading branch information
jan-cerny committed Nov 6, 2024
1 parent e6e3371 commit 257d257
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion shared/templates/sysctl/sce-bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ function pass_if_set_correctly()
found_value=$(grep -P "$regex" $files | sed -E "s/$regex/\1/")
if [[ -n "$found_value" ]] ; then
if [[ "$found_value" == "$expected_value" ]] ; then
return 0
found=1
else
return 1
fi
fi
done
if [[ $found == 1 ]] ; then
return 0
fi
return 1
}

Expand Down

0 comments on commit 257d257

Please sign in to comment.