StackStorm / StackStorm/st2

WinRM PS Script Runner Env Variable Injection Failure

Open
#5,214 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

When providing more than one value to the environment option in a rule file or in the stackstorm webui, the winrm_ps_script runner fails to inject all of the provided environment variables into the powershell session. It seems to only use the last object provided.

STACKSTORM VERSION

st2 3.2.0, on Python 3.6.9 :: Ubuntu 18.04.4 LTS - One-line install.
st2 3.4.1 on Python 3.6.13 :: Ubuntu 16.04.7 LTS - Vagrant (current)

Steps to reproduce the problem

Show how to reproduce the problem, using a minimal test-case. Make sure to include any content
(pack content - workflows, actions, etc.) which are needed to reproduce the problem.
Test-ST2EnvVars.ps1.txt
test_st2_env_vars.yaml.txt
sys-testenvvars.yaml.txt

Expected Results

Powershell script output should list all provided environment variables in rule file or via webUI as separate environment variables available to the session for use.

Actual Results

Only the last variable in the list is injected
st2output.txt

verified, only one env variable coming through in windows event log
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the winrm_ps_script runner and the supplied Test-ST2EnvVars.ps1.txt, test_st2_env_vars.yaml.txt, and sys-testenvvars.yaml.txt files to reproduce how multiple environment values are handled. Trace the environment option from the rule file or web UI into the PowerShell session, then verify with st2output.txt that every supplied variable is available rather than only the last one.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, python
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.