Skip to content

Commit

Permalink
Fix for Kerberos Vault persistence check
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Jun 23, 2023
1 parent 95f43b6 commit 36323b0
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions machinery/src/cloud/Cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit 36323b0

Please sign in to comment.