]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/ceph-helpers: display rejected string
authorKefu Chai <kchai@redhat.com>
Wed, 12 Apr 2017 04:33:53 +0000 (12:33 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 12 Apr 2017 08:34:51 +0000 (16:34 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/workunits/ceph-helpers.sh

index 316e826f803f5ed2004be9c6b49813890d3a1f10..c43a369c717b0a24d1c12f3216a525dd38e5bfdd 100755 (executable)
@@ -1443,19 +1443,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
 }