rundeck / rundeck-cli

CLI tool for Rundeck
https://rundeck.github.io/rundeck-cli/
Apache License 2.0
132 stars 52 forks source link

Node attributes are not substituted in adhoc commands #552

Open leonboot opened 3 months ago

leonboot commented 3 months ago

I would expect to be able to use node and/or job attributes in ad hoc commands, just like in regular job scripts (like @node.name@, @job.project@, or @node.some_custom_attribute@) but it seems this is not supported, or I haven't found the proper notation.

I have tried the following command on a project that has two nodes, both having an attribute called stage:

 rd adhoc --follow --project=my-project --filter='stage: .*' -- echo @node.stage@

This results in the following output:

# Started execution 974785 running 2024-06-18T09:45:20+0200 - https://my-rundeck-server/project/my-project/execution/show/99999 adhoc echo @node.stage@
@node.stage@
@node.stage@

Wrapping the command in single or double quots made no difference, nor did omitting the --.

I noticed an --interpreter flag, but its description, Script interpreter string, doesn't make it clear to me what its purpose is and if this might be the key to getting the attribute substition to work.

Is attribute substition actually supported for ad hoc commands? And if so, could this be added to the documentation?