From ae0cda39b1cdc1e0e59b5069789aaf0c2f3ea67d Mon Sep 17 00:00:00 2001 From: Kiefer Chang Date: Thu, 18 Jun 2020 15:42:50 +0800 Subject: [PATCH] stop.sh: do not block script when there is no running cluster A query for current fsid is called inside `do_killcephadm`. This blocks the script when there is no running cluster. The fix avoids entering the function if cephadm command fails or returns no daemons. The change also hides the following output for non-cephadm environments: ``` Unable to locate any of ['podman', 'docker'] ``` Fixes: https://tracker.ceph.com/issues/46067 Signed-off-by: Kiefer Chang (cherry picked from commit 9884b9313db506a35b4e49d46c754965d90476ed) --- src/stop.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stop.sh b/src/stop.sh index 7af7908a5aba6..4afc7bcdbe355 100755 --- a/src/stop.sh +++ b/src/stop.sh @@ -156,7 +156,8 @@ if [ $stop_all -eq 1 ]; then fi fi - if [ "$($CEPHADM_DIR_PATH/cephadm ls)" != "[]" ]; then + daemons="$($CEPHADM_DIR_PATH/cephadm ls 2> /dev/null)" + if [ $? -eq 0 -a "$daemons" != "[]" ]; then do_killcephadm fi -- 2.39.5