Rundeck "JSON key /value mapper" LogFilter,变量在下一步中不可用
Rundeck "JSON key /value mapper" LogFilter, variable not available in next step
我正在 运行安装 Rundeck 社区版 (3.4.3 2021-08-23)。
我有一个 (winRM) Powershell 命令步骤,它创建一个简单的 JSON 输出。
@{Hello="World";Simple="Test"} | ConvertTo-Json
在第 1 步中,我添加了“JSON jq key/value 映射器”。
The configuration of the LogFilter is very simple. Just a . (dot) direct passthrough of JSON data. The prefix is set to data.
接下来的步骤#2 是一个简单的输出。 运行 作为 (winRM) Powershell 命令。只是写变量输出。
Write-Output "$result.Simple"
一旦我 运行 它我可以看到 JSON 是在步骤 #1 中生成的,并被日志过滤器正确解析。如果我尝试在步骤 #2 中访问变量值,它是空的并产生“无输出”。
Both steps 1 and 2 ok. But variable empty. No output from step #2.
我成功使用日志过滤器“键值数据”和“多行正则表达式数据捕获”。但是“JSON jq key/value 映射器”似乎工作方式不同。
我也尝试过使用大写和小写变量名。在 LogFilter 配置中使用“result”、“data”并且没有前缀。但是我不知道如何访问变量中的数据。
日志过滤器:https://resources.rundeck.com/plugins/jq-json-log-filter/
对命令步骤使用 ${data.name}
或对脚本步骤使用 @data.name@
。我做了一个从 JSON 文件中获取值的基本示例。
Rundeck 工作定义:
- defaultTab: nodes
description: ''
executionEnabled: true
id: fb6042da-5e4c-46d2-a2c1-d3a486ce019f
loglevel: INFO
name: JSONHelloWorld
nodeFilterEditable: false
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- exec: cat /Users/myuser/Desktop/example.json
plugins:
LogFilter:
- config:
filter: .
logData: 'true'
prefix: result
type: json-mapper
- exec: echo ${data.firstName}
keepgoing: false
strategy: node-first
uuid: fb6042da-5e4c-46d2-a2c1-d3a486ce019f
Check结果。
我正在 运行安装 Rundeck 社区版 (3.4.3 2021-08-23)。 我有一个 (winRM) Powershell 命令步骤,它创建一个简单的 JSON 输出。
@{Hello="World";Simple="Test"} | ConvertTo-Json
在第 1 步中,我添加了“JSON jq key/value 映射器”。
The configuration of the LogFilter is very simple. Just a . (dot) direct passthrough of JSON data. The prefix is set to data.
接下来的步骤#2 是一个简单的输出。 运行 作为 (winRM) Powershell 命令。只是写变量输出。
Write-Output "$result.Simple"
一旦我 运行 它我可以看到 JSON 是在步骤 #1 中生成的,并被日志过滤器正确解析。如果我尝试在步骤 #2 中访问变量值,它是空的并产生“无输出”。
Both steps 1 and 2 ok. But variable empty. No output from step #2.
我成功使用日志过滤器“键值数据”和“多行正则表达式数据捕获”。但是“JSON jq key/value 映射器”似乎工作方式不同。 我也尝试过使用大写和小写变量名。在 LogFilter 配置中使用“result”、“data”并且没有前缀。但是我不知道如何访问变量中的数据。
日志过滤器:https://resources.rundeck.com/plugins/jq-json-log-filter/
对命令步骤使用 ${data.name}
或对脚本步骤使用 @data.name@
。我做了一个从 JSON 文件中获取值的基本示例。
Rundeck 工作定义:
- defaultTab: nodes
description: ''
executionEnabled: true
id: fb6042da-5e4c-46d2-a2c1-d3a486ce019f
loglevel: INFO
name: JSONHelloWorld
nodeFilterEditable: false
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- exec: cat /Users/myuser/Desktop/example.json
plugins:
LogFilter:
- config:
filter: .
logData: 'true'
prefix: result
type: json-mapper
- exec: echo ${data.firstName}
keepgoing: false
strategy: node-first
uuid: fb6042da-5e4c-46d2-a2c1-d3a486ce019f
Check结果。