Job template user input option

Hi,

i want to create a job template with user input type and with 2 options (yes or no)
after that i want to make a condition with user input option

this is an example that i want to do :

if  <%= input("aidememo") %> = yes ;
then
   ----------
else
  -------------
fi

my problem is that the condition doesn’t work, i received this error :

/var/tmp/foreman-ssh-cmd-568ef059-a2b0-4d71-b946-d61cd9439d34/script: line 25: no: command not found

line 25 is :
if <%= input(“aidememo”) %> = yes ;

i tried several thing likje between but no success

is there anyone can help me ?

thanks a lot

ludo

You either have to use a proper erb if-else block, or make the test something bash understands.
For erb it would look something like this:

<% if input("foo") == 'yes' -%>
----
<% else -%>
----
<% end -%>

For something bash understands, you need to modify the if line to result in a proper bash test like this:

if [ <%= input("foo") %> == "yes" ]
then

hi,

thanks a lot for your quick help
it is so simple :slight_smile:

it works fine

thanks

ludo