Fix panic on kv put command with no arguments (#4389)

This commit is contained in:
Kevin Wang 2018-04-18 15:45:49 -07:00 committed by Brian Kassouf
parent 6eb2f2f8a3
commit f1e46a0d76
1 changed files with 5 additions and 0 deletions

View File

@ -97,6 +97,11 @@ func (c *KVPutCommand) Run(args []string) int {
stdin = c.testStdin
}
if len(args) < 1 {
c.UI.Error(fmt.Sprintf("Not enough arguments (expected 1, got %d)", len(args)))
return 1
}
var err error
path := sanitizePath(args[0])
path, err = addPrefixToVKVPath(path, "data")