mirror of https://github.com/status-im/consul.git
Back out implicit -kvdetails functionality
This commit is contained in:
parent
0d48559416
commit
94689b6ecd
|
@ -40,7 +40,7 @@ func (c *cmd) init() {
|
|||
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
|
||||
c.flags.BoolVar(&c.kvDetails, "kvdetails", false,
|
||||
"Provides a detailed KV space usage breakdown for any KV data that's been stored.")
|
||||
c.flags.IntVar(&c.kvDepth, "kvdepth", 0,
|
||||
c.flags.IntVar(&c.kvDepth, "kvdepth", 2,
|
||||
"Can only be used with -kvdetails. The key prefix depth used to breakdown KV store data. Defaults to 2.")
|
||||
c.flags.StringVar(&c.kvFilter, "kvfilter", "",
|
||||
"Can only be used with -kvdetails. Limits KV key breakdown using this prefix filter.")
|
||||
|
@ -277,20 +277,6 @@ func (c *cmd) enhance(file io.Reader) (SnapshotInfo, error) {
|
|||
// kvEnhance populates the struct with all of the snapshot's
|
||||
// size information for KV data stored in it
|
||||
func (c *cmd) kvEnhance(keyType string, val interface{}, size int, info *SnapshotInfo) {
|
||||
// automatically set kvDetails to true if a depth or filter
|
||||
// is provided. this allows the user to omit the -kvdetails
|
||||
// flag if they prefer.
|
||||
if c.kvDepth != 0 || c.kvFilter != "" {
|
||||
c.kvDetails = true
|
||||
}
|
||||
|
||||
// set the default depth if one wasn't specified with -kvdepth.
|
||||
// this is used rather than the flag default to facilitate the
|
||||
// above shortcut.
|
||||
if c.kvDetails && c.kvDepth == 0 {
|
||||
c.kvDepth = 2
|
||||
}
|
||||
|
||||
if c.kvDetails {
|
||||
if keyType != "KVS" {
|
||||
return
|
||||
|
|
|
@ -149,21 +149,3 @@ func TestSnapshotInspectKVDetailsDepthFilterCommand(t *testing.T) {
|
|||
want := golden(t, t.Name(), ui.OutputWriter.String())
|
||||
require.Equal(t, want, ui.OutputWriter.String())
|
||||
}
|
||||
|
||||
func TestSnapshotInspectKVDetailsCommandNoDetailsFlag(t *testing.T) {
|
||||
|
||||
filepath := "./testdata/backupWithKV.snap"
|
||||
|
||||
// Inspect the snapshot
|
||||
ui := cli.NewMockUi()
|
||||
c := New(ui)
|
||||
args := []string{"-kvdepth", "3", filepath}
|
||||
|
||||
code := c.Run(args)
|
||||
if code != 0 {
|
||||
t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String())
|
||||
}
|
||||
|
||||
want := golden(t, t.Name(), ui.OutputWriter.String())
|
||||
require.Equal(t, want, ui.OutputWriter.String())
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
ID 2-12426-1604593650375
|
||||
Size 17228
|
||||
Index 12426
|
||||
Term 2
|
||||
Version 1
|
||||
|
||||
Type Count Size
|
||||
---- ---- ----
|
||||
KVS 27 12.3KB
|
||||
Register 5 3.4KB
|
||||
Index 11 285B
|
||||
Autopilot 1 199B
|
||||
Session 1 199B
|
||||
CoordinateBatchUpdate 1 166B
|
||||
Tombstone 2 146B
|
||||
FederationState 1 139B
|
||||
ChunkingState 1 12B
|
||||
---- ---- ----
|
||||
Total 16.8KB
|
||||
|
||||
Key Name Count Size
|
||||
---- ---- ----
|
||||
vault/sys/policy 3 3.3KB
|
||||
vault/logical/0989e79e-06cd-5374-c8c0-4c6d675bc1c9 3 1.8KB
|
||||
vault/core/leader 1 1.6KB
|
||||
vault/sys/token 3 1KB
|
||||
vault/core/mounts 1 675B
|
||||
vault/core/wrapping 1 633B
|
||||
vault/core/local-mounts 1 450B
|
||||
vault/core/auth 1 423B
|
||||
vault/core/cluster 2 388B
|
||||
vault/core/keyring 1 320B
|
||||
vault/core/master 1 237B
|
||||
vault/core/seal-config 1 211B
|
||||
vault/logical/5c018b68-3573-41d3-0c33-04bce60cd6b0 1 210B
|
||||
vault/core/hsm 1 189B
|
||||
vault/core/local-audit 1 185B
|
||||
vault/core/local-auth 1 183B
|
||||
vault/core/audit 1 179B
|
||||
vault/core/lock 1 170B
|
||||
vault/core/shamir-kek 1 159B
|
||||
vault/sys/counters 1 155B
|
||||
---- ---- ----
|
||||
Total 12.3KB
|
Loading…
Reference in New Issue