Skip to content

Commit 50cc4d1

Browse files
Refine error message when cgroupsv2 mount or path are not resolved
1 parent 1e4a114 commit 50cc4d1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ monit_isolation_classid=2958295041
1919
#
2020
# Prefer cgroup.controllers; also accept stat(2) filesystem type for hosts where
2121
# the file is missing from the mount view but the root is still cgroup2fs.
22-
monit_using_unified_cgroup_v2() {
22+
system_using_unified_cgroup_v2() {
2323
[ -f /sys/fs/cgroup/cgroup.controllers ] && return 0
2424
[ "$(stat -fc %T /sys/fs/cgroup 2>/dev/null)" = "cgroup2fs" ]
2525
}
2626

2727
permit_monit_access() {
28-
if monit_using_unified_cgroup_v2; then
28+
if system_using_unified_cgroup_v2; then
2929
# cgroupv2 (unified hierarchy)
3030
# Create a sub-cgroup under the current process's cgroup and move into it.
3131
# The iptables rules match on this cgroup path.
3232
cgroup_mount="$(awk '$1 == "cgroup2" && $3 == "cgroup2" { print $2 }' /proc/self/mounts)"
3333
nb_matching_cgroup_mounts=$(echo "$cgroup_mount" | wc -l)
3434
current_cgroup="$(grep '^0::' /proc/self/cgroup | cut -d: -f3)"
3535
if [ -z "${cgroup_mount}" ] || [ "${nb_matching_cgroup_mounts}" -ne 1 ] || [ -z "${current_cgroup}" ]; then
36-
echo "permit_monit_access: unable to resolve cgroup v2 mount or path" >&2
36+
echo "permit_monit_access: unable to resolve cgroup v2 mount or path. current_cgroup=${current_cgroup} cgroup_mount=${cgroup_mount}" >&2
3737
return 1
3838
fi
3939
monit_access_cgroup="${cgroup_mount}${current_cgroup}/monit-api-access"

0 commit comments

Comments
 (0)