From b1d3c1a322dd611b3608732e7ef31cf15e671845 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 12 Apr 2017 12:33:53 +0800 Subject: [PATCH] qa/workunits/ceph-helpers: display rejected string Signed-off-by: Kefu Chai (cherry picked from commit 0196e154ed2e164cf55b0d7ed9f9cdd1f4f50100) --- qa/workunits/ceph-helpers.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/qa/workunits/ceph-helpers.sh b/qa/workunits/ceph-helpers.sh index 8da5295ac3c41..e0896ef0b9f97 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 } -- 2.39.5