StackStorm / StackStorm/st2

Feature Request - Validate/notify about duplicate parameters in action YAML

Open
#3,532 1 comment 1 reaction 1 assignee View on GitHub

@lakshmi-kannan is already working on this.

Since Jul 6, 2017.

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

Description

I had a little SNAFU today when registering an action with the following YAML:

---
description: "None (yet)"
enabled: true
runner_type: "python-script"
entry_point: lib/run_operation.py
name: "login"
parameters:
  server:
    type: string
    description: "Optional override of the Men&Mice server in <connection> (required if <connection> is not specified)."
    required: false
  username:
    type: string
    description: "Optional override of the Men&Mice username in <connection> (example: username@domain.tld) (required if <connection> is not specified)."
    required: false
  password:
    type: string
    description: "Optional override of the Men&Mice password in <connection>. (required if <connection> is not specified)"
    required: false
    secret: true
  server:
    type: string
    required: true
  login_name:
    type: string
    required: true
  password:
    type: string
    required: true

Note the password and server parameters are duplicated.

This caused a small issue where the second password definition did not have secret: true specified. The result was that when i executed the action the password was displayed on the command line:

$ st2 run menandmice.login server=server.domain.tld username=user password=xxx login_name=login
id: 59551a75a814c0698925a78f
status: succeeded
parameters: 
  password: xxx
  server: server.domain.tld
  username: user
result: 
  exit_code: 0
  result:
    session: xyz123
  stderr: ''
  stdout: ''

Feature Request
It might be a good idea to validate and notify with a warning/error if a duplicate parameter is specified in the action's YAML.

Also, are there other places it makes sense to check for duplicates?

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.