繁体   English   中英

Rundeck -> 我们如何将捕获的键值数据传递到邮件模板中

[英]Rundeck -> how can we pass the captured Key Value Data into the mail Template

我们如何将捕获的键值数据(日志过滤器)传递到邮件模板中,

例如,我当前的模板如下所示

<html>
    <head>
        <title>create Heap dump</title>
    </head>
    <body>
       <p>
       Hi,<br><br>
       ${option.Description} <br>
       ${logoutput.data}<br><br>
       Regards,<br>
       Game World</p>
    </body>
</html>

目前我无法传递任何捕获的值,如 ${data.value}。 我有什么遗漏吗?

最简单的方法是将该数据值变量导出到全局变量,然后在通知中使用它。

  1. 第一步使用过滤器打印一些文本,捕获数据值并将其存储在${data.MYDATA}中。
  2. 第二步采用该数据变量并使用“全局变量”步骤创建一个全局变量。
  3. 您可以在任何通知中将该全局变量用作${export.myvariable}

看一下这个作业定义示例:

- defaultTab: nodes
  description: ''
  executionEnabled: true
  id: ea07f41a-71b4-4ed9-91fb-6113de996e48
  loglevel: INFO
  name: TestJob
  nodeFilterEditable: false
  notification:
    onsuccess:
      plugin:
        configuration:
          authentication: None
          body: ${export.myglobal}
          contentType: application/json
          method: POST
          remoteUrl: https://any/webhook/url
          timeout: '30000'
        type: HttpNotification
  notifyAvgDurationThreshold: null
  plugins:
    ExecutionLifecycle: {}
  scheduleEnabled: true
  schedules: []
  sequence:
    commands:
    - exec: env
      plugins:
        LogFilter:
        - config:
            invalidKeyPattern: \s|\$|\{|\}|\\
            logData: 'true'
            regex: ^(USER)\s*=\s*(.+)$
          type: key-value-data
    - configuration:
        export: myglobal
        group: export
        value: ${data.USER*}
      nodeStep: false
      type: export-var
    - exec: echo ${export.myglobal}
    keepgoing: false
    strategy: node-first
  uuid: ea07f41a-71b4-4ed9-91fb-6113de996e48

使用 HTTP 通知(在正文部分),您可以看到该值(与使用电子邮件通知的情况相同)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM