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

Rename "generic" secret backend to "kv" #3292

Merged
merged 11 commits into from Sep 15, 2017
2 changes: 1 addition & 1 deletion api/renewer_integration_test.go
Expand Up @@ -25,7 +25,7 @@ func TestRenewer_Renew(t *testing.T) {
defer pgDone()

t.Run("group", func(t *testing.T) {
t.Run("generic", func(t *testing.T) {
t.Run("kv", func(t *testing.T) {
t.Parallel()

if _, err := client.Logical().Write("secret/value", map[string]interface{}{
Expand Down
42 changes: 41 additions & 1 deletion command/mount_test.go
Expand Up @@ -22,6 +22,46 @@ func TestMount(t *testing.T) {
},
}

args := []string{
"-address", addr,
"kv",
}
if code := c.Run(args); code != 0 {
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
}

client, err := c.Client()
if err != nil {
t.Fatalf("err: %s", err)
}

mounts, err := client.Sys().ListMounts()
if err != nil {
t.Fatalf("err: %s", err)
}

mount, ok := mounts["kv/"]
if !ok {
t.Fatal("should have kv mount")
}
if mount.Type != "kv" {
t.Fatal("should be kv type")
}
}

func TestMount_Generic(t *testing.T) {
core, _, token := vault.TestCoreUnsealed(t)
ln, addr := http.TestServer(t, core)
defer ln.Close()

ui := new(cli.MockUi)
c := &MountCommand{
Meta: meta.Meta{
ClientToken: token,
Ui: ui,
},
}

args := []string{
"-address", addr,
"generic",
Expand All @@ -42,7 +82,7 @@ func TestMount(t *testing.T) {

mount, ok := mounts["generic/"]
if !ok {
t.Fatal("should have generic mount")
t.Fatal("should have generic mount path")
}
if mount.Type != "generic" {
t.Fatal("should be generic type")
Expand Down
2 changes: 1 addition & 1 deletion command/remount.go
Expand Up @@ -65,7 +65,7 @@ Usage: vault remount [options] from to
the data associated with the backend (such as configuration), will
be preserved.

Example: vault remount secret/ generic/
Example: vault remount secret/ kv/

General Options:
` + meta.GeneralOptionsUsage()
Expand Down
6 changes: 3 additions & 3 deletions command/remount_test.go
Expand Up @@ -24,7 +24,7 @@ func TestRemount(t *testing.T) {

args := []string{
"-address", addr,
"secret/", "generic",
"secret/", "kv",
}
if code := c.Run(args); code != 0 {
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
Expand All @@ -45,8 +45,8 @@ func TestRemount(t *testing.T) {
t.Fatal("should not have mount")
}

_, ok = mounts["generic/"]
_, ok = mounts["kv/"]
if !ok {
t.Fatal("should have generic")
t.Fatal("should have kv")
}
}
10 changes: 5 additions & 5 deletions command/server.go
Expand Up @@ -72,7 +72,7 @@ type ServerCommand struct {
}

func (c *ServerCommand) Run(args []string) int {
var dev, verifyOnly, devHA, devTransactional, devLeasedGeneric, devThreeNode bool
var dev, verifyOnly, devHA, devTransactional, devLeasedKV, devThreeNode bool
var configPath []string
var logLevel, devRootTokenID, devListenAddress, devPluginDir string
var devLatency, devLatencyJitter int
Expand All @@ -87,7 +87,7 @@ func (c *ServerCommand) Run(args []string) int {
flags.BoolVar(&verifyOnly, "verify-only", false, "")
flags.BoolVar(&devHA, "dev-ha", false, "")
flags.BoolVar(&devTransactional, "dev-transactional", false, "")
flags.BoolVar(&devLeasedGeneric, "dev-leased-generic", false, "")
flags.BoolVar(&devLeasedKV, "dev-leased-kv", false, "")
flags.BoolVar(&devThreeNode, "dev-three-node", false, "")
flags.Usage = func() { c.Ui.Output(c.Help()) }
flags.Var((*sliceflag.StringFlag)(&configPath), "config", "config")
Expand Down Expand Up @@ -141,7 +141,7 @@ func (c *ServerCommand) Run(args []string) int {
devListenAddress = os.Getenv("VAULT_DEV_LISTEN_ADDRESS")
}

if devHA || devTransactional || devLeasedGeneric || devThreeNode {
if devHA || devTransactional || devLeasedKV || devThreeNode {
dev = true
}

Expand Down Expand Up @@ -263,8 +263,8 @@ func (c *ServerCommand) Run(args []string) int {
}
if dev {
coreConfig.DevToken = devRootTokenID
if devLeasedGeneric {
coreConfig.LogicalBackends["generic"] = vault.LeasedPassthroughBackendFactory
if devLeasedKV {
coreConfig.LogicalBackends["kv"] = vault.LeasedPassthroughBackendFactory
}
if devPluginDir != "" {
coreConfig.PluginDirectory = devPluginDir
Expand Down
8 changes: 4 additions & 4 deletions http/handler_test.go
Expand Up @@ -157,8 +157,8 @@ func TestSysMounts_headerAuth(t *testing.T) {
"auth": nil,
"data": map[string]interface{}{
"secret/": map[string]interface{}{
"description": "generic secret storage",
"type": "generic",
"description": "key/value secret storage",
"type": "kv",
"config": map[string]interface{}{
"default_lease_ttl": json.Number("0"),
"max_lease_ttl": json.Number("0"),
Expand Down Expand Up @@ -188,8 +188,8 @@ func TestSysMounts_headerAuth(t *testing.T) {
},
},
"secret/": map[string]interface{}{
"description": "generic secret storage",
"type": "generic",
"description": "key/value secret storage",
"type": "kv",
"config": map[string]interface{}{
"default_lease_ttl": json.Number("0"),
"max_lease_ttl": json.Number("0"),
Expand Down