Adding step based on action template through API results in wrong handling of parameter

When constructing Octopus project through API, we have found Octopus misbehavior regarding creating steps from step templates.

If parameter Octopus.Action.RunOnServer is created with False value (PascalStyle) (please screenshot json.png) then Octopus UI fails to correctly set radiobutton in Octopus UI (please see the selection.png screenshot). If you explicitly select “deployment target”, then Octopus resaves deployment-process object with Octopus.Action.RunOnServer set to false (all lower case).

So it seems that Octopus UI makes a difference between False and false, which is weird. It’s not a big issue, but requires to add .ToString().ToLower() in our script :slight_smile: Perhaps there are other places in Octopus which also make a difference.

json.png

selection.png

Hi Dmitry,

Thanks for getting in touch.

You are correct. When using the API, any booleans in the Properties dictionary need to be entered in lowercase, as the UI values are case sensitive in these cases (due to the value matching in the HTML input field):

<control-group label="Run on">
<label class="radio"><input type="radio" ng-model='action.Properties["Octopus.Action.RunOnServer"]' value="false" /> Deployment target</label>
<label class="radio"><input type="radio" ng-model='action.Properties["Octopus.Action.RunOnServer"]' value="true" /> Octopus Server</label>
</control-group>

This is not something we validate when importing step templates. I have raised an issue here for you to track when this has been addressed.

Cheers
Mark

Hi Mark! We’re not importing step template here. We’re creating Octopus project with step based on step template. Step template is already imported in the Library.

The issue with upper/lower case is that we don’t explicitly define the value in JSON, but rather operating API through PowerShell, passing PowerShell custom objects (PSCustomObject), serialized into JSON by the PowerShell itself (ConvertTo-Json). And it converts booleans with first letter capitalized.

Hi Dmitry,

Ahh I see. Thanks for clarifying :slight_smile:

I’ve updated the GitHub issue to cover this situation with PowerShell and boolean conversion issues.

Cheers
Mark