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

vault audit list -format json does not return JSON when list is empty #6775

Closed
netson opened this issue May 22, 2019 · 0 comments · Fixed by #6776
Closed

vault audit list -format json does not return JSON when list is empty #6775

netson opened this issue May 22, 2019 · 0 comments · Fixed by #6776
Milestone

Comments

@netson
Copy link

netson commented May 22, 2019

Describe the bug
The command vault audit list -format json does not consistently return a valid JSON object; if there are no audits enabled, the returned result is simply a string. When trying to automate certain steps, always receiving a JSON object is mandatory.

To Reproduce
Steps to reproduce the behavior:

  1. make sure no audits are enabled (vault audit disable ***)
  2. run vault audit list -format json
  3. you will see the following:
    No audit devices are enabled.

Expected behavior
I would expect to see an empty JSON object: {}

Environment:

  • Vault Server Version (retrieve with vault status):
# vault status
Key             Value
---             -----
Seal Type       shamir
Initialized     true
Sealed          false
Total Shares    5
Threshold       3
Version         1.1.2
Cluster Name    vault-cluster-3e8e9591
Cluster ID      7110de04-06b4-e73d-c2ce-94ac9616cde6
HA Enabled      false
  • Vault CLI Version (retrieve with vault version):
Vault v1.1.2 ('0082501623c0b704b87b1fbc84c2d725994bac54')
  • Server Operating System/Architecture:
# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic
  • Vault server configuration file(s):
# cat /etc/vault.d/vault.hcl
api_addr = "http://127.0.0.1:8201"
ui = true

backend "file" {
    path = "/opt/vault"
}

listener "tcp" {
    address = "127.0.0.1:8200"
    tls_disable = 1
}

Additional context
None

@jefferai jefferai added this to the 1.1.3 milestone May 22, 2019
briankassouf pushed a commit that referenced this issue Jun 4, 2019
* Audit listing with format json returns json, not a string

Fixes #6775

* list, kv list and namespace list with format json returns json, not a string

* Changed audit list return code to 2 which aligns with other list commands return codes
briankassouf pushed a commit that referenced this issue Jun 4, 2019
* Audit listing with format json returns json, not a string

Fixes #6775

* list, kv list and namespace list with format json returns json, not a string

* Changed audit list return code to 2 which aligns with other list commands return codes
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