【问题标题】:Disable NonZeroResultCode status details in Rundeck notification on job failure在 Rundeck 作业失败通知中禁用 NonZeroResultCode 状态详细信息
【发布时间】:2019-08-21 08:21:39
【问题描述】:

在作业失败(退出代码> 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]

是否可以通过禁用/隐藏此消息以仅发送脚本输出,如成功作业运行时的附件?

【问题讨论】:

    标签: rundeck


    【解决方案1】:

    你可以在你的步骤中强制“exit 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多