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

cli/api: Update plugin listing to always include version info in the response #17347

Merged
merged 6 commits into from
Sep 29, 2022

Conversation

tomhjp
Copy link
Contributor

@tomhjp tomhjp commented Sep 28, 2022

I found an issue where vault plugin list -detailed auth returned an empty response. There was also a small bug in the api package's JSON tags that stopped type getting populated in details.

$ vault plugin list -detailed auth
Name    Type    Version    Deprecation Status
----    ----    -------    ------------------

api: Updated the typed call to always use the untyped API so that it can always include the extra details like version etc.
cli: Added detailed key to JSON output, and type/version to non-detailed output because a plugin name on its own is not enough to specify a plugin, so it's not very informative to just list the names.

New output:

$ vault plugin list secret
Name             Version
----             -------
kv               v0.13.0+builtin
mongodb          v1.13.0+builtin.vault
...

$ vault plugin list -detailed auth
Name          Type    Version                  Deprecation Status
----          ----    -------                  ------------------
alicloud      auth    v0.13.0+builtin          supported
app-id        auth    v1.13.0+builtin.vault    pending removal
...

$ vault plugin list
Name                                 Type        Version
----                                 ----        -------
alicloud                             auth        v0.13.0+builtin
app-id                               auth        v1.13.0+builtin.vault
...

$ vault plugin list -format=json
{
  "auth": [
    "alicloud",
    ...
  ],
  "database": [
    "cassandra-database-plugin",
    "couchbase-database-plugin",
    ...
  ],
  "details": [
    {
      "type": "auth",
      "name": "alicloud",
      "version": "v0.13.0+builtin",
      "builtin": true,
      "deprecation_status": "supported"
    },
    ...

$ vault plugin list -format=json auth
{
  "auth": [
    "alicloud",
    ...
  ],
  "details": [
    {
      "type": "auth",
      "name": "alicloud",
      "version": "v0.13.0+builtin",
      "builtin": true,
      "deprecation_status": "supported"
    },
    ...

@tomhjp tomhjp requested review from swenson, mpalmi and tvoran September 28, 2022 16:52
@tomhjp tomhjp force-pushed the client-plugin-list-versions branch from 93b0225 to cf76ca3 Compare September 28, 2022 16:52
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work for me, though I am noticing that vault plugin list secret output is not sorted by name, while vault plugin list auth is (whether -detailed is supplied or not).

@tomhjp
Copy link
Contributor Author

tomhjp commented Sep 28, 2022

vault plugin list secret output is not sorted by name

Good spot! There was a silly sorting bug which I've fixed in 1c6a3d1

Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this test needs to be updated, but otherwise 👍

{
"lists",
nil,
"Plugins",
0,
},
}

Copy link
Contributor

@mpalmi mpalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Should we update the docs to show the new output?

@tomhjp tomhjp requested a review from taoism4504 as a code owner September 29, 2022 15:54
@tomhjp
Copy link
Contributor Author

tomhjp commented Sep 29, 2022

Should we update the docs to show the new output?

Thanks for the reminder! Done in bfab936

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

Successfully merging this pull request may close these issues.

3 participants