rundeck - 在 Rundeck 作业失败通知中禁用 NonZeroResultCode 状态详细信息
问题描述
在作业失败(退出代码 > 0)时,Rundeck 会自动将详细的状态信息添加到通知附件中:
Failed: NonZeroResultCode: Remote command failed with exit status 1
Execution failed: 3709 in project test_project_1: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [host1: NonZeroResultCode: Remote command failed with exit status 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:host1)=BaseDataContext{{exec={exitCode=0}}}, ContextView(node:host1)=BaseDataContext{{exec={exitCode=0}}}}, base=null)} ]}, Node failures: {host1=[NonZeroResultCode: Remote command failed with exit status 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:host1)=BaseDataContext{{exec={exitCode=0}}}, ContextView(node:host1)=BaseDataContext{{exec={exitCode=0}}}}, base=null)} ]}, status: failed]
是否可以通过禁用/隐藏此消息仅发送成功作业运行时的附件中的脚本输出?
解决方案
您可以在您的步骤中强制“退出 0”,将其包装在像这样的一些内联脚本上
#!/bin/bash
touch /root/test 2> /dev/null
if [ $? -eq 1 ]
then
# whatever you want
echo "Successfully created file"
exit 0
else
echo "Could not create file" >&2
exit 1
fi
推荐阅读
- amazon-web-services - 如何列出 AWS RedShift 中的所有存储过程
- django - 具有多个查询参数的动态查询集过滤
- java - Web3j 读取单个事务的所有发出的事件
- python - 转换没有循环的numpy数组
- web-applications - 集成网络应用
- javascript - 如果条件格式正确,如何将 JS-CSS-HTML Formatter 配置为多行?
- markdown - 是否可以在 Markdown 代码块中显示空格?
- php - 为 mPDF v8.0.6 添加字体
- r - 分组箱线图的R plotly下拉事件
- java - 这个错误“SoapFaultClientException”是什么意思?