diff --git a/changes/issue-6127-fleet-debug-windows b/changes/issue-6127-fleet-debug-windows new file mode 100644 index 0000000000..aff203f1c3 --- /dev/null +++ b/changes/issue-6127-fleet-debug-windows @@ -0,0 +1 @@ +* Fixed the `fleetctl debug` `archive` and `errors` commands on Windows. diff --git a/cmd/fleetctl/debug.go b/cmd/fleetctl/debug.go index 74160a8c91..5bf25ab10e 100644 --- a/cmd/fleetctl/debug.go +++ b/cmd/fleetctl/debug.go @@ -66,7 +66,7 @@ func writeFile(filename string, bytes []byte, mode os.FileMode) error { } func outfileName(name string) string { - return fmt.Sprintf("fleet-%s-%s", name, nowFn().Format(time.RFC3339)) + return fmt.Sprintf("fleet-%s-%s", name, nowFn().Format("20060102150405Z")) } func outfileNameWithExt(name string, ext string) string { diff --git a/cmd/fleetctl/debug_test.go b/cmd/fleetctl/debug_test.go index 22458cf93c..2eb1e57a6e 100644 --- a/cmd/fleetctl/debug_test.go +++ b/cmd/fleetctl/debug_test.go @@ -211,11 +211,11 @@ func TestFilenameFunctions(t *testing.T) { t.Run("outfileName builds a file name using the name provided + current time ", func(t *testing.T) { name := outfileName("test") - assert.Equal(t, name, "fleet-test-1969-06-19T21:44:05Z") + assert.Equal(t, "fleet-test-19690619214405Z", name) }) t.Run("outfileNameWithExt builds a file name using the name and extension provided + current time ", func(t *testing.T) { name := outfileNameWithExt("test", "go") - assert.Equal(t, name, "fleet-test-1969-06-19T21:44:05Z.go") + assert.Equal(t, "fleet-test-19690619214405Z.go", name) }) }