]> git.apps.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)
committerNathan Cutler <ncutler@suse.com>
Mon, 3 Jul 2017 07:56:01 +0000 (09:56 +0200)
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 0196e154ed2e164cf55b0d7ed9f9cdd1f4f50100)

qa/workunits/ceph-helpers.sh

index 8da5295ac3c41f5cad885bee8b8069e244d33f60..e0896ef0b9f97a5692b4e013f9bc6c3c45aa039b 100755 (executable)
@@ -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
 }