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
}