diff options
| author | Miguel Pires <miguel.pires@canonical.com> | 2022-07-12 08:48:36 +0100 |
|---|---|---|
| committer | Miguel Pires <miguel.pires@canonical.com> | 2022-07-12 08:48:36 +0100 |
| commit | 25096a85fb9a41c67acb819e301fe2a3a8ab7114 (patch) | |
| tree | 5a4b1cf4c27fe6d4536d8d774bcb5f4bb12b3451 | |
| parent | 4662c1b3479803d790c7b615b51ccb67fc7b1374 (diff) | |
Revert "cmd/snap: require state-file arg for debug commands"
This reverts commit 7dd38752d46da8b5b05f421957aa849a724b44ea. Some spread tests depend on this command assuming state.json in the current directory if none is provided.
| -rw-r--r-- | cmd/snap/cmd_debug_state.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/snap/cmd_debug_state.go b/cmd/snap/cmd_debug_state.go index 31f2bb546d..befdf05e42 100644 --- a/cmd/snap/cmd_debug_state.go +++ b/cmd/snap/cmd_debug_state.go @@ -59,7 +59,7 @@ type cmdDebugState struct { Positional struct { StateFilePath string `positional-args:"yes" positional-arg-name:"<state-file>"` - } `positional-args:"yes" required:"yes"` + } `positional-args:"yes"` } var cmdDebugStateShortHelp = i18n.G("Inspect a snapd state file.") @@ -72,6 +72,9 @@ func (c byChangeSpawnTime) Swap(i, j int) { c[i], c[j] = c[j], c[i] } func (c byChangeSpawnTime) Less(i, j int) bool { return c[i].SpawnTime().Before(c[j].SpawnTime()) } func loadState(path string) (*state.State, error) { + if path == "" { + path = "state.json" + } r, err := os.Open(path) if err != nil { return nil, fmt.Errorf("cannot read the state file: %s", err) |
