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

st2 webhook get -h output is not very helpful #4048

Closed
LindsayHill opened this issue Mar 21, 2018 · 2 comments
Closed

st2 webhook get -h output is not very helpful #4048

LindsayHill opened this issue Mar 21, 2018 · 2 comments

Comments

@LindsayHill
Copy link
Contributor

st2 webook get -h says I should provide the ref-or-id:

extreme@EWC:~$ st2 webhook get -h
usage: st2 webhook get [-h] [-t TOKEN] [--api-key API_KEY] [-j] [-y]
                       [-a ATTR [ATTR ...]]
                       ref-or-id

Get individual webhook.

positional arguments:
  ref-or-id             Reference or ID of the webhook.

optional arguments:
  -h, --help            show this help message and exit
  -t TOKEN, --token TOKEN
                        Access token for user authentication. Get
                        ST2_AUTH_TOKEN from the environment variables by
                        default.
  --api-key API_KEY     Api Key for user authentication. Get ST2_API_KEY from
                        the environment variables by default.
  -j, --json            Print output in JSON format.
  -y, --yaml            Print output in YAML format.
  -a ATTR [ATTR ...], --attr ATTR [ATTR ...]
                        List of attributes to include in the output. "all" or
                        unspecified will return all attributes.

OK, so let's try to find some refs or IDs:

extreme@EWC:~$ st2 webhook list
+------------------+------+--------------------------------------+-------------+-------------------------------+
| type             | pack | name                                 | description | parameters                    |
+------------------+------+--------------------------------------+-------------+-------------------------------+
| core.st2.webhook | core | d954edc5-29a1-4889-8521-c7524db4e41a |             | {u'url': u'splunk_link_up'}   |
| core.st2.webhook | core | 4006eaed-fef6-4307-9cf3-c854b488e23f |             | {u'url': u'splunk_link_down'} |
| core.st2.webhook | core | 7dc9c344-6d48-49d5-927e-126048fca4ee |             | {u'url': u'foobar'}           |
| core.st2.webhook | core | 48ff01c6-5992-4bf2-aa5d-7f13f2291958 |             | {u'url': u'switch/add'}       |
| core.st2.webhook | core | 3dc235f8-03e7-4ee4-bfee-f3d178b2fb07 |             | {u'url': u'sample'}           |
| core.st2.webhook | core | 0579e60d-63f5-4a5c-8d38-61a493eb4df6 |             | {u'url': u'splunk_bgp_down'}  |
| core.st2.webhook | core | 8751fd94-e6e6-4cc4-aeb0-e064364ae40f |             | {u'url': u'gope'}             |
| core.st2.webhook | core | ba1fa2ec-8a05-4f1c-9b1c-e72d7710d968 |             | {u'url': u'elk_link_flap'}    |
| core.st2.webhook | core | fe97d0b1-4bf5-4bc9-9bd5-0b116d92a01d |             | {u'url': u'splunk_link_flap'} |
+------------------+------+--------------------------------------+-------------+-------------------------------+
extreme@EWC:~$

OK, try something else:

extreme@EWC:~$ st2 webhook list -a name id ref
+--------------------------------------+--------------------------+-------------------------------------------+
| name                                 | id                       | ref                                       |
+--------------------------------------+--------------------------+-------------------------------------------+
| d954edc5-29a1-4889-8521-c7524db4e41a | 59a4f729c3540c5ef8574ba8 | core.d954edc5-29a1-4889-8521-c7524db4e41a |
| 4006eaed-fef6-4307-9cf3-c854b488e23f | 59a4f729c3540c5ef8574ba6 | core.4006eaed-fef6-4307-9cf3-c854b488e23f |
| 7dc9c344-6d48-49d5-927e-126048fca4ee | 5a7de3b799c96b570c024f99 | core.7dc9c344-6d48-49d5-927e-126048fca4ee |
| 48ff01c6-5992-4bf2-aa5d-7f13f2291958 | 5889d7bbc3540c15ec75c57e | core.48ff01c6-5992-4bf2-aa5d-7f13f2291958 |
| 3dc235f8-03e7-4ee4-bfee-f3d178b2fb07 | 58878352c3540c44b57c17e6 | core.3dc235f8-03e7-4ee4-bfee-f3d178b2fb07 |
| 0579e60d-63f5-4a5c-8d38-61a493eb4df6 | 58878352c3540c44b57c17e9 | core.0579e60d-63f5-4a5c-8d38-61a493eb4df6 |
| 8751fd94-e6e6-4cc4-aeb0-e064364ae40f | 58878352c3540c44b57c17d8 | core.8751fd94-e6e6-4cc4-aeb0-e064364ae40f |
| ba1fa2ec-8a05-4f1c-9b1c-e72d7710d968 | 58878352c3540c44b57c17e4 | core.ba1fa2ec-8a05-4f1c-9b1c-e72d7710d968 |
| fe97d0b1-4bf5-4bc9-9bd5-0b116d92a01d | 58878352c3540c44b57c17eb | core.fe97d0b1-4bf5-4bc9-9bd5-0b116d92a01d |
+--------------------------------------+--------------------------+-------------------------------------------+
extreme@EWC:~$

OK, let's try retrieving a webhook details via id or ref:

extreme@EWC:~$ st2 webhook get 59a4f729c3540c5ef8574ba8
Webhook "59a4f729c3540c5ef8574ba8" is not found.

extreme@EWC:~$ st2 webhook get core.d954edc5-29a1-4889-8521-c7524db4e41a
Webhook "core.d954edc5-29a1-4889-8521-c7524db4e41a" is not found.

extreme@EWC:~$

Nope. Neither of those work.

Let's try something else - try using the url: param as the ref-or-id:

extreme@EWC:~$ st2 webhook get foobar
+------------+--------------------------------------------------------------+
| Property   | Value                                                        |
+------------+--------------------------------------------------------------+
| type       | core.st2.webhook                                             |
| pack       | core                                                         |
| name       | 7dc9c344-6d48-49d5-927e-126048fca4ee                         |
| parameters | {                                                            |
|            |     "url": "foobar"                                          |
|            | }                                                            |
| id         | 5a7de3b799c96b570c024f99                                     |
| ref        | core.7dc9c344-6d48-49d5-927e-126048fca4ee                    |
| uid        | trigger:core:7dc9c344-6d48-49d5-927e-                        |
|            | 126048fca4ee:a3f3ddcb0e0fba664871a74b705a82ef                |
+------------+--------------------------------------------------------------+
extreme@EWC:~$

Ah. Success at last. But not very intuitive, no?

@arm4b
Copy link
Member

arm4b commented Mar 22, 2018

Same issue in API definition:

https://api.stackstorm.com/api/v1/webhooks/#/webhooks_controller.get_one
name string Entity reference or id

@lakshmi-kannan lakshmi-kannan self-assigned this Apr 2, 2018
@lakshmi-kannan
Copy link
Contributor

Good issue. The original intent was to do st2 webhook get on the URL. So while things work per design, the UX is horrendous as you've pointed out. I'll pick this up and see where I go with it.

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

No branches or pull requests

3 participants