Pass option text not value when using cascading options

149 views
Skip to first unread message

Jeff

unread,
Jun 17, 2020, 1:49:43 PM6/17/20
to rundeck-discuss
Group, I have defined a 3 layer cascade of options
project - values are json pointers
node - values are json pointers
database - values are json data

when i go to use any of these options in my script command I get the value when i need the option text. Is there a way to accomplish this?

example:
projects.json
[
{"name":"project1","value":"node1.json"},
{"name":"project2","value":node2.json"}
]

node.json
[
{"name":"node1","value":"database1.json"},
{"name":"node2","value":database2.json"}
]

database.json
[
{"name":"database1","value":"DB1"},
{"name":"database2","value":DB2"}
]

when i use in command like this (D:\RunDeck_Deployments\DeploySQLScripts.ps1 -URL ${option.url} -BUILDNUMBER ${option.cm} -SQLINSTANCE ${option.node} -DATABASENAME ${option.databasename} -PROJECTNAME ${option.project})


thank you
Jeff

Reiner Acuña

unread,
Jun 17, 2020, 2:21:49 PM6/17/20
to rundeck-discuss
Hi Jeff,

Right now you can get only the value (like this thread:https://groups.google.com/d/msg/rundeck-discuss/taqNtK2y-NE/iU_iznKhBgAJ). Maybe a good option is to design a workflow that gets the option name via script or like this example:

https://github.com/rundeck/rundeck/issues/5898#issuecomment-611817976

That gets the node name (with the "trick" of setting the name equals than value) using basename tool using an inline bash script (https://linux.die.net/man/1/basename)

Regards!

Jeff

unread,
Jun 17, 2020, 3:23:07 PM6/17/20
to rundeck-discuss
Thank you reiner. I went with naming the json files so a replace('.json','') in my script as first thing gave me the desired string from the values passed by rundeck

Jeff
Reply all
Reply to author
Forward
0 new messages