3

I have a JOB rundeck called "TEST"

I have an option called country

this option retreives a list of key, value from a remote URL as :

[
  {"name":"FRANCE", "value":"FR"},
  {"name":"ITALY", "value":"IT"},
  {"name":"ALGERIA", "value":"DZ"}
] 

I would like to use both of the name and the value in a job step.

echo ${option.country.name} 
echo ${option.country.value} 

But this doesn't work and I'm not able to get the name of the parameter

getting the value can be done using ${option.country}

Is there any trick to get the parameter name ???

Stranger B.
  • 9,004
  • 21
  • 71
  • 108
  • 2
    afaik, there is no way you can get the option.[name].name by rundeck's function. you may wish to call a cgi script with value as argument and the script return the 'name' field of the json – Yang Apr 01 '17 at 21:39
  • Can someone please tell if this provision has been added yet or not. Is there a way to access an options name? – coder006 Apr 26 '18 at 08:41

1 Answers1

0

Just for the record answer: Maybe the best approach is to create some script-step that reads the JSON file and extracts the name, also, you can use the same value name like this example (of course is not applicable for all cases).

MegaDrive68k
  • 3,768
  • 2
  • 9
  • 51