From 0196e154ed2e164cf55b0d7ed9f9cdd1f4f50100 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 --- 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 316e826f803..c43a369c717 100755 --- a/qa/workunits/ceph-helpers.sh +++ b/qa/workunits/ceph-helpers.sh @@ -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 } -- 2.39.5