KBEC-00289 Running ectool does not take default values for required parameters


When starting a job from ectool, if you don't provide a required parameter it fails stating that there is a missing parameter, even though the parameter is defined to have a default value. This is counter intuitive since there is already a default value defined.

Non-required parameters get their default values.


This functionality actually works as designed, below we explain how it works. But to change the behavior, you will need to do one of the following:

* If you want the runProcedure to take the default values, remove the "Required" check box, and the default values will be used
* If you want the parameter to be required, you will have to supply the values on the command line using the --actualParameter option

When you run the procedure in the UI, the default parameter is shown in the UI but you still have to accept it by clicking the Run button. When you are running from the command line, the default values are not used, so you must supply a value for all required parameters. The web UI pre-populates the default value and passes it along across the wire.

If you tail the commander.log file, then interact with the UI to launch the procedure then you’ll see this:

<?xml version="1.0" encoding="UTF-8"?>

<requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="commander.xsd" version="2.0" sessionId="[PROTECTED]">
<request requestId="0">

If you try to launch on the command line:

<?xml version="1.0" encoding="UTF-8"?>
<requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="commander.xsd" version="2.2" timeout="180" sessionId="AZKE2DSYCG39N6M1">
<request requestId="1">

<responses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="commander.xsd" version="2.3" dispatchId="21488">
<error requestId="1">
<message><![CDATA[Missing parameter(s) to 'Test': param1]]></message>

Notice in the web ui version we passed an actualParameter. In the command line invocation we did not.

You can get the default value through the API and pass it to your ectool command via script. Here is how you can get the default value on the formal parameter (as I said, the default value is stored in the db)

vagrant@commander4to5:~$ /opt/electriccloud/electriccommander/bin/ectool getFormalParameters Default --procedureName Test

<response requestId="1">
<description />

If you tail the commander.log when viewing the "Run…" page you will see that the web ui also issued the getFormalParameters query as well.

Our web UI merely issues multiple requests to get the default value and pre-populate the default value into the actualParameter.

Have more questions? Submit a request


Powered by Zendesk