From 36323b076f049370bbd9a50e5b85f6e108a90395 Mon Sep 17 00:00:00 2001 From: Cedric Verstraeten Date: Fri, 23 Jun 2023 21:13:13 +0200 Subject: [PATCH] Fix for Kerberos Vault persistence check --- machinery/src/cloud/Cloud.go | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/machinery/src/cloud/Cloud.go b/machinery/src/cloud/Cloud.go index 3389578..2099385 100644 --- a/machinery/src/cloud/Cloud.go +++ b/machinery/src/cloud/Cloud.go @@ -689,19 +689,8 @@ func VerifyPersistence(c *gin.Context) { if err == nil && uri != "" && accessKey != "" && secretAccessKey != "" { - // Open test-480p.mp4 - file, err := os.Open("./data/test-480p.mp4") - if err != nil { - msg := "VerifyPersistence: error reading test-480p.mp4: " + err.Error() - log.Log.Error(msg) - c.JSON(400, models.APIResponse{ - Data: msg, - }) - } - defer file.Close() - client := &http.Client{} - req, err := http.NewRequest("POST", uri+"/ping", file) + req, err := http.NewRequest("POST", uri+"/ping", nil) req.Header.Add("X-Kerberos-Storage-AccessKey", accessKey) req.Header.Add("X-Kerberos-Storage-SecretAccessKey", secretAccessKey) resp, err := client.Do(req) @@ -717,10 +706,19 @@ func VerifyPersistence(c *gin.Context) { timestamp := time.Now().Unix() fileName := strconv.FormatInt(timestamp, 10) + "_6-967003_" + config.Name + "_200-200-400-400_24_769.mp4" - content := []byte("test-file") - body := bytes.NewReader(content) - req, err := http.NewRequest("POST", uri+"/storage", body) + // Open test-480p.mp4 + file, err := os.Open("./data/test-480p.mp4") + if err != nil { + msg := "VerifyPersistence: error reading test-480p.mp4: " + err.Error() + log.Log.Error(msg) + c.JSON(400, models.APIResponse{ + Data: msg, + }) + } + defer file.Close() + + req, err := http.NewRequest("POST", uri+"/storage", file) if err == nil { req.Header.Set("Content-Type", "video/mp4")