]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
stop.sh: do not block script when there is no running cluster 35637/head
authorKiefer Chang <kiefer.chang@suse.com>
Thu, 18 Jun 2020 07:42:50 +0000 (15:42 +0800)
committerKiefer Chang <kiefer.chang@suse.com>
Thu, 18 Jun 2020 07:51:32 +0000 (15:51 +0800)
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 <kiefer.chang@suse.com>
src/stop.sh

index 7af7908a5aba6fae63aba8b5361568c8127c1957..4afc7bcdbe355c93809b182113a184e2192c58d2 100755 (executable)
@@ -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