From: Kefu Chai Date: Wed, 12 Apr 2017 04:33:53 +0000 (+0800) Subject: qa/workunits/ceph-helpers: display rejected string X-Git-Tag: v11.2.1~115^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b1d3c1a322dd611b3608732e7ef31cf15e671845;p=ceph.git qa/workunits/ceph-helpers: display rejected string Signed-off-by: Kefu Chai (cherry picked from commit 0196e154ed2e164cf55b0d7ed9f9cdd1f4f50100) --- diff --git a/qa/workunits/ceph-helpers.sh b/qa/workunits/ceph-helpers.sh index 8da5295ac3c..e0896ef0b9f 100755 --- a/qa/workunits/ceph-helpers.sh +++ b/qa/workunits/ceph-helpers.sh @@ -1343,19 +1343,20 @@ function erasure_code_plugin_exists() { local plugin=$1 local status local grepstr + local s case `uname` in FreeBSD) grepstr="Cannot open.*$plugin" ;; *) grepstr="$plugin.*No such file" ;; esac - if ceph osd erasure-code-profile set TESTPROFILE plugin=$plugin 2>&1 | - grep "$grepstr" ; then - # display why the string was rejected. - ceph osd erasure-code-profile set TESTPROFILE plugin=$plugin - status=1 - else - status=0 + s=$(ceph osd erasure-code-profile set TESTPROFILE plugin=$plugin 2>&1) + local status=$? + if [ $status -eq 0 ]; then ceph osd erasure-code-profile rm TESTPROFILE + elif ! echo $s | grep --quiet "$grepstr" ; then + status=1 + # display why the string was rejected. + echo $s fi return $status }