mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-20 06:54:32 +00:00
monitor velero logs and fix E2E issues
1. Capture Velero pod log and K8S cluster event; 2. Fix wrong path of storageclass yaml file issue caused by pert test; 3. Fix change storageclass test issue that no sc named 'default' in EKS cluster; 4. Support AWS credential as config format; 5. Support more E2E script input parameters like standy cluster plugins and provider. Signed-off-by: danfengl <danfengl@vmware.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
@@ -87,3 +88,25 @@ func CMDExecWithOutput(checkCMD *exec.Cmd) (*[]byte, error) {
|
||||
}
|
||||
return &jsonBuf, err
|
||||
}
|
||||
|
||||
func WriteToFile(content, fileName string) error {
|
||||
file, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
fmt.Println("fail to open file", err)
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
write := bufio.NewWriter(file)
|
||||
_, err = write.WriteString(content)
|
||||
if err != nil {
|
||||
fmt.Println("fail to WriteString file", err)
|
||||
return err
|
||||
}
|
||||
err = write.Flush()
|
||||
if err != nil {
|
||||
fmt.Println("fail to Flush file", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user