如果先前的剧本失败了,该如何运行下一个ansible剧本

时间:2019-07-03 07:34:05

标签: shell jenkins ansible

我们正在使用ansible测试我们的设置。测试结果记录在文件中。一旦完成了可完成的剧本操作,我们就可以查看测试摘要文件并知道通过了多少测试摘要文件。现在,该过程可以通过詹金斯实现自动化。在Jenkins中,在shell提示符下,下面的代码正在执行。

cd ${repodir}
ansible-playbook -i rhelhost plugin.yml
result=$?
ansible-playbook -i rhelhost testsummary.yml
if [ $result -ne 0 ]; then  
  echo "ERROR: Execution is failed"
  exit 1
fi

但是,如果仅plugin.yml执行成功完成,则将执行testsummary.yml。如果失败,甚至结果= $?行未执行。

如何在plugin.yml中失败的情况下执行这些行?即使某些测试失败,我们的测试摘要也将提供到那时为止发生的结果。

1 个答案:

答案 0 :(得分:1)

尝试以下

   import cv2 as cv
   from scipy import ndimage

   img1 = cv.imread('Please put your file name')

   top_left_x = min([x1,x2,x3,x4])
   top_left_y = min([y1,y2,y3,y4])
   bot_right_x = max([x1,x2,x3,x4])
   bot_right_y = max([y1,y2,y3,y4])

   y_right =bot_right_y + 1
   x_right =bot_right_x + 1

  cropped = img[top_left_y: y_right, top_left_x: x_right]

  rotate = ndimage.rotate(cropped, ang)
相关问题