|
1 | 1 | # CHANGELOG |
2 | 2 |
|
3 | 3 |
|
| 4 | +## v0.11.1 (2026-03-14) |
| 5 | + |
| 6 | +### Bug Fixes |
| 7 | + |
| 8 | +- **cli**: Format nested values as YAML and add --json flag to get |
| 9 | + ([#32](https://github.com/cdds-ab/vaultctl/pull/32), |
| 10 | + [`899ab2d`](https://github.com/cdds-ab/vaultctl/commit/899ab2df0ac1566497c51abc9c24b115989e632c)) |
| 11 | + |
| 12 | +## Problem |
| 13 | + |
| 14 | +`vaultctl get` on structured entries (dicts, lists) outputs Python `repr()` format — single quotes, |
| 15 | + no indentation, not parseable by `jq` or other tools. Example: |
| 16 | + |
| 17 | +``` Type: secretText |
| 18 | +
|
| 19 | +domains: [{'name': 'docker build hosts', 'credentials': [{'type': 'x509ClientCert', ... |
| 20 | +
|
| 21 | +``` |
| 22 | + |
| 23 | +This makes credentialStore entries with 50+ nested credentials completely unreadable. |
| 24 | + |
| 25 | +## Solution |
| 26 | + |
| 27 | +### 1. Human-readable output: YAML formatting |
| 28 | + |
| 29 | +Added `_format_value()` helper (`cli.py:35-46`) that formats nested values: - **Strings**: returned |
| 30 | + as-is (no change to existing behavior) - **Dicts/Lists**: formatted as YAML via |
| 31 | + `yaml.dump(default_flow_style=False)` - **Other types**: converted via `str()` |
| 32 | + |
| 33 | +The `get` command now calls `_format_value(value[f])` instead of directly printing `value[f]`, so |
| 34 | + nested structures render as readable YAML with proper indentation. |
| 35 | + |
| 36 | +### 2. Machine-readable output: `--json` flag |
| 37 | + |
| 38 | +New `--json` flag on the `get` command outputs the value as JSON: |
| 39 | + |
| 40 | +```bash vaultctl get vault_jenkins_credentials --json | jq '.global.credentials | length' ``` |
| 41 | + |
| 42 | +Works with `--field` too: |
| 43 | + |
| 44 | +```bash vaultctl get db_creds --field username --json ``` |
| 45 | + |
| 46 | +Uses `json.dumps(indent=2, ensure_ascii=False)` for readable JSON that pipes cleanly to `jq`. |
| 47 | + |
| 48 | +### Files changed |
| 49 | + |
| 50 | +- `src/vaultctl/cli.py`: - Added `_format_value()` helper (lines 35-46) - Added `--json` / |
| 51 | + `output_json` option to `get` command - Changed dict field output from `value[f]` to |
| 52 | + `_format_value(value[f])` - JSON output path for both full value and `--field` access |
| 53 | + |
| 54 | +## Test plan - [ ] `vaultctl get <dict-key>` shows readable YAML (not Python repr) - [ ] `vaultctl |
| 55 | + get <dict-key> --json | jq .` parses correctly - [ ] `vaultctl get <string-key>` unchanged (plain |
| 56 | + string output) - [ ] `vaultctl get <dict-key> --field username` unchanged - [ ] All 298 existing |
| 57 | + tests pass |
| 58 | + |
| 59 | +Co-authored-by: Fred Thiele <8555720+f3rdy@users.noreply.github.com> |
| 60 | + |
| 61 | + |
4 | 62 | ## v0.11.0 (2026-03-14) |
5 | 63 |
|
6 | 64 | ### Features |
|
0 commit comments