Skip to content

Commit

Permalink
Skip Formatting For NIL Secret (#18163)
Browse files Browse the repository at this point in the history
* Skip formatting for a nil secret data

* Same change for put

* Add changelog

* update changelog

* modify filtered output
  • Loading branch information
ltcarbonell authored and AnPucel committed Jan 14, 2023
1 parent e4bbd4c commit 1b2c296
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/18163.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cli/kv: skip formatting of nil secrets for patch and put with field parameter set
```
8 changes: 8 additions & 0 deletions command/kv_patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ func (c *KVPatchCommand) Run(args []string) int {
if code != 0 {
return code
}
if secret == nil {
// Don't output anything if there's no secret
return 0
}

if c.flagField != "" {
return PrintRawField(c.UI, secret, c.flagField)
}

if Format(c.UI) == "table" {
outputPath(c.UI, fullPath, "Secret Path")
Expand Down

0 comments on commit 1b2c296

Please sign in to comment.