fix fleetctl debug commands on Windows (#6186)
As reported in #6127, the `fleetctl debug` `archive` and `errors` commands were failing on Windows because filenames are not allowed to contain colons `:`. This changeset removes colina from the filename of the archives generated by both commands.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
* Fixed the `fleetctl debug` `archive` and `errors` commands on Windows.
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user