st2 icon indicating copy to clipboard operation
st2 copied to clipboard

Action policy "action.concurrency.attr" doesn't respect default values

Open minsis opened this issue 4 years ago • 0 comments

SUMMARY

Action policy for attr doesn't respect when it has default values for the attribute.

STACKSTORM VERSION

Paste the output of st2 --version: st2 3.6.0, on Python 3.6.8

OS, environment, install method

OL7 all-in-one st2 server installed on bare VM

Steps to reproduce the problem

Created a simple local action with a default value of sleep 60 for the cmd

description: Action that executes an arbitrary Linux command on the localhost.
enabled: true
entry_point: ''
name: loop_test
parameters:
  cmd:
    description: Arbitrary Linux command to be executed on the remote host(s).
    required: true
    type: string
    default: "sleep 60"
  sudo:
    immutable: true
runner_type: "local-shell-cmd"

Created an attr policy to cancel with a threshold of 2

name: "test my loop policy"
description: ""
enabled: true
resource_ref: "examples.loop_test"
policy_type: "action.concurrency.attr"
parameters:
    action: "cancel"
    threshold: 2
    attributes:
      - cmd

Execute the action three times without filling in the cmd attribute. All three will run without the third action being canceled.

Fill in cmd with sleep 30 or even the same default value of sleep 60. The third action will be properly canceled. (In the screenshot they are showing orange because of the 60 second action timeout)

image

Expected Results

Any action execution >2 with a default attribute should've been canceled

Actual Results

Any action execution >2 with a default attribute did not cancel

minsis avatar Dec 02 '21 03:12 minsis