]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart.sh: Avoiding ceph-conf error when create a new cluster. 21019/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 23 Mar 2018 15:30:44 +0000 (23:30 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 23 Mar 2018 15:30:44 +0000 (23:30 +0800)
This partly revert commit:f437598cfcabbd66c372bc8.
Before firstly creating a ceph cluster, there is no ceph.conf.
If specify a non-exist ceph.conf, ceph-conf will meet error.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/vstart.sh

index 1e8aea2bcd4c8ba328da322f305fc631e7184410..32e11cb25253713c95f0b1dcbb7f06ce0abdcd62 100755 (executable)
@@ -349,14 +349,16 @@ if [ "$overwrite_conf" -eq 0 ]; then
 else
     if [ "$new" -ne 0 ]; then
         # only delete if -n
-        asok_dir=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)`
-        if [ $asok_dir != /var/run/ceph ]; then
+       if [ -e "$conf_fn" ]; then
+         asok_dir=`dirname $($CEPH_BIN/ceph-conf  -c $conf_fn --show-config-value admin_socket)`
+         rm -- "$conf_fn"
+         if [ $asok_dir != /var/run/ceph ]; then
             [ -d $asok_dir ] && rm -f $asok_dir/* && rmdir $asok_dir
-        fi
-        if [ -z "$CEPH_ASOK_DIR" ]; then
+         fi
+       fi
+       if [ -z "$CEPH_ASOK_DIR" ]; then
             CEPH_ASOK_DIR=`mktemp -u -d "${TMPDIR:-/tmp}/ceph-asok.XXXXXX"`
         fi
-        [ -e "$conf_fn" ] && rm -- "$conf_fn"
     else
         CEPH_ASOK_DIR=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)`
         # -k is implied... (doesn't make sense otherwise)