-
-
Notifications
You must be signed in to change notification settings - Fork 782
Closed
Labels
Description
SUMMARY
In an action's parameters, decrypting an encrypted value in the K/V store results in a misleading error message if that key either doesn't exist or is not encrypted
STACKSTORM VERSION
3.5.0
OS, environment, install method
RHEL 8, Python 3.6.8
Steps to reproduce the problem
st2 key set test_bool "true"
test_action.yaml
---
name: 'test_action'
runner_type: 'remote-shell-cmd'
description: 'Test action inputs from the k/v store'
enabled: true
entry_point: ''
pack: 'test_pack'
parameters:
username:
type: 'string'
description: 'Username to login to the remote system'
required: true
password:
type: 'string'
description: 'Password to login to the remote system'
required: true
hosts:
type: 'string'
description: 'Comma separated list of hosts to run the command on'
required: true
cmd:
immutable: true
default: 'echo "TEST: {{ test_bool }}"'
connect_timeout:
type: 'integer'
description: 'SSH connect timeout in seconds'
default: 30
test_bool:
type: boolean
description: "Test boolean variable"
default: "{{ st2kv.system.test_bool }}"
test_encrypt:
type: string
description: "Test encrypted variable"
required: false
secret: true
default: "{{ st2kv.system.test_encrypt | decrypt_kv }}"
st2 run test_pack.test_action username="root" password="pass" hosts="localhost"
Expected Results
Prior to 3.5, if test_encrypt does not exist in the K/V store then a None value would be used for that parameter. If that can't be done then an error message about the test_encrypt parameter would be expected
Actual Results
Running the action above will result in the following misleading error if test_encrypt either is not in the k/v store or if it exists but isn't encrypted:
ERROR: 400 Client Error: Bad Request
MESSAGE: '{{ st2kv.system.test_bool }}' is not of type 'boolean' for url: http://127.0.0.1:9101/executions