mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-23 18:40:53 +00:00
sched: create dataItemsDir during a performance test if not exist
This commit is contained in:
parent
2a05c78600
commit
983272ce6a
@ -23,6 +23,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
@ -134,6 +135,10 @@ func dataItems2JSONFile(dataItems DataItems, namePrefix string) error {
|
|||||||
|
|
||||||
destFile := fmt.Sprintf("%v_%v.json", namePrefix, time.Now().Format(dateFormat))
|
destFile := fmt.Sprintf("%v_%v.json", namePrefix, time.Now().Format(dateFormat))
|
||||||
if *dataItemsDir != "" {
|
if *dataItemsDir != "" {
|
||||||
|
// Ensure the "dataItemsDir" path to be valid.
|
||||||
|
if err := os.MkdirAll(*dataItemsDir, 0750); err != nil {
|
||||||
|
return fmt.Errorf("dataItemsDir path %v does not exist and cannot be created: %v", *dataItemsDir, err)
|
||||||
|
}
|
||||||
destFile = path.Join(*dataItemsDir, destFile)
|
destFile = path.Join(*dataItemsDir, destFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user