Skip to content

Commit 5e3b543

Browse files
Simplify cgroup_mount error checking logic
Remove redundant conditional as suggested in #599 (review)
1 parent e9d0103 commit 5e3b543

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

stemcell_builder/stages/bosh_monit/assets/monit-access-helper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ permit_monit_access() {
3232
cgroup_mount="$(awk '$1 == "cgroup2" && $3 == "cgroup2" { print $2 }' /proc/self/mounts)"
3333
nb_matching_cgroup_mounts=$(echo "$cgroup_mount" | grep -c '^.')
3434
current_cgroup="$(grep '^0::' /proc/self/cgroup | cut -d: -f3)"
35-
if [ -z "${cgroup_mount}" ] || [ "${nb_matching_cgroup_mounts}" -ne 1 ] || [ -z "${current_cgroup}" ]; then
35+
if [ "${nb_matching_cgroup_mounts}" -ne 1 ] || [ -z "${current_cgroup}" ]; then
3636
echo "permit_monit_access: unable to resolve cgroup v2 mount or path. current_cgroup=${current_cgroup} cgroup_mount=${cgroup_mount} nb_matching_cgroup_mounts=${nb_matching_cgroup_mounts}" >&2
3737
return 1
3838
fi

0 commit comments

Comments
 (0)