Winrm-ps-script only passes last env pair

st2 3.2.0, on Python 3.6.9

Hello, I’m currently writing my first stackstorm action. It is a winrm-ps-script action

---
  name: "Invoke-ShipAndZip"
  runner_type: "winrm-ps-script"
  description: "Trigger Ship and Zip Processs on given host"
  enabled: true
  entry_point: "scripts/invoke-shipandzip.ps1"
  parameters:
    host:
      description: "hostname"
      type: "string"
      required: true
    scheme:
      default: "http"
      type: "string"
      required: true
    port:
      default: 5985
      type: "integer"
      required: true
    transport:
      default: credssp
      type: "string"
      required: true
    verify_ssl_cert:
      default: false
      type: boolean
      required: true

The action is 99% working, but when i give it a series of json parameters to ENV in the webui, I only get the last key/value pair to show up in the script.
This is a test script, trying to work out stackstorm

Param(
[string]$strTest = [string]$env:varStr,
[int]$intTest = [int]$env:varInt,
[bool]$boolTest = [bool]$env:varBool
)

start-transcript .\logfile.txt -append -force
Write-Output "stringTest = $strTest"
Write-Output "intTest = $intTest"
Write-Output "boolTest = $boolTest"
Write-Output "varStr = $env:varStr"
Write-Output "varInt = $($env:varInt.ToString())"
Write-Output "varBool = $env:varBool"
stop-transcript

so if i put

{ "varInt": "11", "varBool": "true", "varStr": "ThisisATest" }

into the env box, i only see $env:varStr showing up at runtime. This also holds true if i swap the order of the pairs, for example if i put varBool last, I’ll get $env:varBool at execution Any ideas?

Ubuntu 18.04
st2client Version: 3.2.0

Solved by reading the documentation more carefully.
https://docs.stackstorm.com/actions.html#converting-existing-scripts-into-actions
Additional parameters that are added to action metadata file become named\positional parameters at script invocation.

Thanks to @nmaludy

1 Like