mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	Sync over
This commit is contained in:
		| @@ -2,7 +2,6 @@ package command | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"path" |  | ||||||
| 	"strings" | 	"strings" | ||||||
|  |  | ||||||
| 	"github.com/mitchellh/cli" | 	"github.com/mitchellh/cli" | ||||||
| @@ -42,7 +41,7 @@ Usage: vault namespace create [options] PATH | |||||||
| } | } | ||||||
|  |  | ||||||
| func (c *NamespaceCreateCommand) Flags() *FlagSets { | func (c *NamespaceCreateCommand) Flags() *FlagSets { | ||||||
| 	return c.flagSet(FlagSetHTTP) | 	return c.flagSet(FlagSetHTTP | FlagSetOutputField | FlagSetOutputFormat) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *NamespaceCreateCommand) AutocompleteArgs() complete.Predictor { | func (c *NamespaceCreateCommand) AutocompleteArgs() complete.Predictor { | ||||||
| @@ -79,21 +78,16 @@ func (c *NamespaceCreateCommand) Run(args []string) int { | |||||||
| 		return 2 | 		return 2 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	_, err = client.Logical().Write("sys/namespaces/"+namespacePath, nil) | 	secret, err := client.Logical().Write("sys/namespaces/"+namespacePath, nil) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		c.UI.Error(fmt.Sprintf("Error creating namespace: %s", err)) | 		c.UI.Error(fmt.Sprintf("Error creating namespace: %s", err)) | ||||||
| 		return 2 | 		return 2 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if c.flagNamespace != notSetNamespace { | 	// Handle single field output | ||||||
| 		namespacePath = path.Join(c.flagNamespace, namespacePath) | 	if c.flagField != "" { | ||||||
|  | 		return PrintRawField(c.UI, secret, c.flagField) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if !strings.HasSuffix(namespacePath, "/") { | 	return OutputSecret(c.UI, secret) | ||||||
| 		namespacePath = namespacePath + "/" |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// Output full path |  | ||||||
| 	c.UI.Output(fmt.Sprintf("Success! Namespace created at: %s", namespacePath)) |  | ||||||
| 	return 0 |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -2,7 +2,6 @@ package command | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"path" |  | ||||||
| 	"strings" | 	"strings" | ||||||
|  |  | ||||||
| 	"github.com/mitchellh/cli" | 	"github.com/mitchellh/cli" | ||||||
| @@ -90,10 +89,6 @@ func (c *NamespaceDeleteCommand) Run(args []string) int { | |||||||
| 		return OutputSecret(c.UI, secret) | 		return OutputSecret(c.UI, secret) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if c.flagNamespace != notSetNamespace { |  | ||||||
| 		namespacePath = path.Join(c.flagNamespace, namespacePath) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if !strings.HasSuffix(namespacePath, "/") { | 	if !strings.HasSuffix(namespacePath, "/") { | ||||||
| 		namespacePath = namespacePath + "/" | 		namespacePath = namespacePath + "/" | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeff Mitchell
					Jeff Mitchell