StackStorm / StackStorm/st2

Validation error when providing numerical key-value parameters from Slack

Open
#2,943 6 comments 0 reactions 1 assignee View on GitHub

@roberterdin is already working on this.

Since Oct 11, 2016.

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

Description

When providing a numerical key-value parameters, e.g. diskspace some-host /var timeout=300, this results in a validation error. (Link to according section in the docs)

From st2api.log

ERROR aliasexecution [-] Unable to execute action. Parameter validation failed.
Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2api/controllers/v1/aliasexecution.py", line 163, in _schedule_execution
    _, action_execution_db = action_service.request(liveaction)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/services/action.py", line 148, in request
    liveaction, execution = create_request(liveaction)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/services/action.py", line 79, in create_request
    allow_default_none=True)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/schema/__init__.py", line 293, in validate
    jsonschema.validate(instance=instance, schema=schema, cls=cls, *args, **kwargs)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/jsonschema/validators.py", line 478, in validate
    cls(schema, *args, **kwargs).validate(instance)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/jsonschema/validators.py", line 123, in validate
    raise error
ValidationError: u'300' is not of type u'integer'

Failed validating u'type' in schema['properties'][u'timeout']:
    {u'default': 1500,
     u'description': u'Time to wait for the action to finish',
     u'type': u'integer'}

On instance[u'timeout']:
    u'300'

This is the according action (edit)alias:


---
name: "remote_diskspace"
description: "Run diskspace analysis on a remote server"
runner_type: local-shell-cmd
entry_point: ""
enabled: true
parameters:
  sudo:
    description: "Run command with sudo"
    type: boolean
    immutable: true
    default: true
  cmd:
    description: "Command to run"
    type: string
    immutable: true
    default: "export ANSIBLE_STDOUT_CALLBACK='json' && /opt/stackstorm/virtualenvs/ansible/bin/ansible-playbook -i /opt/ansible-action/cmdb_connect/dynamic_inventory.sh /opt/ansible-action/playbooks/diskspace.yaml --extra-vars='{\"hosts\":\"{{hosts|replace('http://','')}}\", \"folder\":\"{{folder|replace('\\\\','/')}}\"}'"
  hosts:
    description: "Ansible hosts"
    type: string
    required: true
  folder:
    description: "Folder to analyze"
    type: string
    required: true
  timeout:
    description: "Time to wait for the action to finish"
    default: 1500

ST2 version: st2 2.0.1

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.