Skip to content

Commit 0114ddf

Browse files
committed
Update truly active resources count with safer empty calculation
1 parent d5b4428 commit 0114ddf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

heartbeat/podman-etcd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,13 +1042,15 @@ get_truly_active_resources_count() {
10421042
local truly_active=""
10431043

10441044
# If no active resources, return 0
1045-
if [ -z "$active_list" ]; then
1045+
# Use word count to handle whitespace-only values
1046+
if [ "$(echo "$active_list" | wc -w)" -eq 0 ]; then
10461047
echo "0"
10471048
return
10481049
fi
10491050

10501051
# If no resources being stopped, return count of active resources
1051-
if [ -z "$stop_list" ]; then
1052+
# Use word count to handle whitespace-only values
1053+
if [ "$(echo "$stop_list" | wc -w)" -eq 0 ]; then
10521054
echo "$active_list" | wc -w
10531055
return
10541056
fi

0 commit comments

Comments
 (0)