#340 new
Duck

Allow empty ${option.name} and eliminate special case handling in scripts

Reported by Duck | June 14th, 2011 @ 06:55 PM

When trying to create a job which called a script with the calling convention "scriptname [option1] [option2]", after reading documentation 1.2.0, section 6.5, I realized that RunDeck does not handle a default option that is empty. For undefined options (ie in my case, a normal calling convention), I must update my scripts to handle RunDeck's expectation that ${option.name} will not be defined.

I'd like to propose that RunDeck handle an unsupplied optional option differently. Instead of not defining the option, requiring any called script to be update, just set the option to nothing. Perhaps a checkbox saying "Allow option to be empty". This would allow Rundeck to call existing scripts like my example above which is pretty standard.

If it did this, then one could configure a job step like this:

Path: /path/to/script
Commandline arguments: ${option.name}

Then scripts could be run as-is, and not have to be updated to deal with a nonexistent ${option.name}. If using variable replacement syntax the model would be to always reference it in quotes:

!/bin/sh

VAR1="@OPTION.NAME@"

When empty, it would resolve to
VAR1=""

IRC Chat attached

Comments and changes to this ticket

  • Duck

    Duck June 15th, 2011 @ 11:47 AM

    One slight correction is that when only dealing with this through the GUI, the shell launched by RunDeck is what complains about the undefined option to be passed to the script. So in this case, if I pass ${option.name} in the GUI for the step's command line, my script never gets called, as RunDeck's attempt to run the command "/path/to/script ${option.name}" results in the "sh: ${option.name} bad substitution" error, and prevents actually executing the script contents.

  • Alex-SF

    Alex-SF July 9th, 2011 @ 01:44 PM

    • Tag set to feature request, options

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

(DEPRECATED) Please use github issues for issue tracking at http://github.com/dtolabs/rundeck/issues

Shared Ticket Bins

People watching this ticket

Attachments

Pages