-
-
Notifications
You must be signed in to change notification settings - Fork 782
Description
I found out this issue while working on the release.
Currently, the script runner doesn't include "False" values for boolean parameter (https://github.com/StackStorm/st2/blob/master/st2common/st2common/models/system/action.py#L277) which means it won't work correctly in scenarios where boolean script parameter is not the last parameter.
For example, from one of our actions:
Script file:
Action metadata file:
---
name: st2_chg_ver_for_st2
description: Change the version for the st2 repo
enabled: true
runner_type: remote-shell-script
entry_point: st2_chg_ver_for_st2.sh
parameters:
project:
type: string
description: Project name for st2
default: st2
position: 0
version:
type: string
description: Version to update to. Should include the patch e.g. 0.1.0
required: true
position: 1
fork:
type: string
description: Fork to use
default: StackStorm
position: 2
branch:
type: string
description: Branch to update
default: master
position: 3
update_mistral:
type: boolean
description: If true, update mistralclient version in requirements.txt.
default: false
position: 4
update_changelog:
type: boolean
description: If true, update version in changelog.
default: false
position: 5
local_repo:
type: string
description: Location where to clone the repo. Programmatically determined if not provided.
position: 6
dir:
immutable: true
default: /home/stanley/
sudo:
immutable: true
default: false
cmd:
immutable: true
default: ""
kwarg_op:
immutable: true
default: "--"...
#!/bin/bash
set -e
PROJECT=$1
VERSION=$2
FORK=$3
BRANCH=$4
UPDATE_MISTRAL=$5
UPDATE_CHANGELOG=$6
LOCAL_REPO=$7
GIT_REPO="git@github.com:${FORK}/${PROJECT}.git"
CWD=`pwd`
PUSH=0
....In this case, if update_mistral and update_changelog parameters default to False, script will get incorrectly called with the following arguments st2_chg_ver_for_st2.sh st2 3.1dev StackStorm master st2_1556296602_602 which is incorrect since argument number 4 will now be local_repo instead of update_mistral.
Actual command line should look like this: st2_chg_ver_for_st2.sh st2 3.1dev StackStorm master 0 0 st2_1556296602_602. In short, False should get serialized as 0 (and we need to document this).