Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching action alias for 'pack install xxx' returns an error #4511

Closed
nmaludy opened this issue Jan 23, 2019 · 0 comments · Fixed by #4512
Closed

Matching action alias for 'pack install xxx' returns an error #4511

nmaludy opened this issue Jan 23, 2019 · 0 comments · Fixed by #4512
Milestone

Comments

@nmaludy
Copy link
Member

nmaludy commented Jan 23, 2019

SUMMARY

Noticed by @ravi on Slack.

When running st2 action-alias match 'pack install vsphere' multiple action-aliases are matched, causing an error.

This is confusing in two ways:

  1. Running that action-alias should not be ambiguous
  2. The help message for st2 action-alias match says it returns a list of matching aliases, but instead it either returns one or it errors.
ISSUE TYPE
  • Bug Report
STACKSTORM VERSION
$ st2 --version
st2 2.10.1, on Python 2.7.5
OS / ENVIRONMENT / INSTALL METHOD
# OS
$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.6 (Maipo)

# Install method
puppet-st2
STEPS TO REPRODUCE
$ st2 action-alias match 'pack install vsphere'
EXPECTED RESULTS
$ st2 action-alias match 'pack install vsphere'
+--------------+-----------------------------------+
| name         | description                       |
+--------------+-----------------------------------+
| pack_install | Install/upgrade StackStorm packs. |
+--------------+-----------------------------------+
ACTUAL RESULTS
$ st2 action-alias match 'pack install vsphere'
ERROR: 400 Client Error: Bad Request
MESSAGE: Command 'pack install vsphere' matched more than 1 pattern for url: http://127.0.0.1:9101/v1/actionalias/match

This is also confusing because st2 action-alias match --help says it should return a list of matching aliases, when instead it either returns a single alias or it errors out if multiple are found.

$ st2 action-alias match --help
usage: st2 action-alias match [-h] [-t TOKEN] [--api-key API_KEY] [-j] [-y]
                              [-a ATTR [ATTR ...]] [-w WIDTH [WIDTH ...]]
                              command

Get the list of action aliases that match the command text.
INVESTIGATION

It appears that the action-alias packs.pack_install has redundant patterns defined: /~https://github.com/StackStorm/st2/blob/master/contrib/packs/aliases/pack_install.yaml#L7-L12

I think the simplest fix is to remove the redundant pattern and change the display text for the one that is left behind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants