From: Changcheng Liu Date: Fri, 10 May 2019 06:09:45 +0000 (+0800) Subject: ceph_common.sh: sort -u to avoid extra operation X-Git-Tag: v15.1.0~2107^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6746624cac95c399aa76388183e2f2d503a24f60;p=ceph.git ceph_common.sh: sort -u to avoid extra operation Use "sort -u" to remove the repeat of any mon/mds/mgr/osd in case of double operation. Signed-off-by: Ovidiu Poncea --- diff --git a/src/ceph_common.sh b/src/ceph_common.sh index 20a2db04c4b..9b469ce4d24 100644 --- a/src/ceph_common.sh +++ b/src/ceph_common.sh @@ -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"