diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2017-08-29 15:11:44 +0800 |
---|---|---|
committer | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2017-08-29 15:25:56 +0800 |
commit | b15b028f061858de71fc98459d562dd76e3aecfe (patch) | |
tree | 281ac0388ceb22f4b9d9a93bcaae503fcba53bbf /resources/ansible_roles/storperf | |
parent | acf3b4ff0b556e121d665e31e893c8dc1159f034 (diff) |
Fix bug that start_job script exit unexpectedly
When `set -o errexit` is enabled in script, the non-zero return value
from `diff` is considered as an error. But actually diff returns 1 when
difference is found. The error exit option should be disabled when dealing
`diff`.
Change-Id: I6270ec8f7036b3d752736a80474468e26a613585
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'resources/ansible_roles/storperf')
-rwxr-xr-x | resources/ansible_roles/storperf/files/start_job.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/resources/ansible_roles/storperf/files/start_job.sh b/resources/ansible_roles/storperf/files/start_job.sh index 19ddbd2f..79057298 100755 --- a/resources/ansible_roles/storperf/files/start_job.sh +++ b/resources/ansible_roles/storperf/files/start_job.sh @@ -99,11 +99,15 @@ else curl -s -X GET "${storperf_api}/jobs?id=$JOB&type=status" \ -o $WORKSPACE/status.json JOB_STATUS=`cat $WORKSPACE/status.json | awk '/Status/ {print $2}' | cut -d\" -f2` + + set +o errexit # disable error exit checking for diff diff $WORKSPACE/status.json $WORKSPACE/old-status.json >/dev/null if [ $? -eq 1 ] then cat $WORKSPACE/status.json fi + set -o errexit + done echo |