]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_common.sh: sort -u to avoid extra operation
authorChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 10 May 2019 06:09:45 +0000 (14:09 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Tue, 9 Jul 2019 08:17:56 +0000 (16:17 +0800)
Use "sort -u" to remove the repeat of any mon/mds/mgr/osd
in case of double operation.

Signed-off-by: Ovidiu Poncea <ovidiu.poncea@windriver.com>
src/ceph_common.sh

index 20a2db04c4be9695222230bc22d9ca8c7a25649f..9b469ce4d24cba1dd3e5152f8e7033537d132345 100644 (file)
@@ -182,10 +182,14 @@ get_name_list() {
     orig="$*"
 
     # extract list of monitors, mdss, osds, mgrs defined in startup.conf
-    allconf="$local "`$CCONF -c $conf -l mon | egrep -v '^mon$' || true ; \
-       $CCONF -c $conf -l mds | egrep -v '^mds$' || true ; \
-       $CCONF -c $conf -l mgr | egrep -v '^mgr$' || true ; \
-       $CCONF -c $conf -l osd | egrep -v '^osd$' || true`
+    allconf=$(for entity in \
+      $local \
+      `$CCONF -c $conf -l mon | egrep -v '^mon$' || true` \
+      `$CCONF -c $conf -l mds | egrep -v '^mds$' || true` \
+      `$CCONF -c $conf -l mgr | egrep -v '^mgr$' || true` \
+      `$CCONF -c $conf -l osd | egrep -v '^osd$' || true`; do
+      echo $entity
+    done | sort -u)
 
     if [ -z "$orig" ]; then
        what="$allconf"