Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paradise timeout #96

Merged
merged 4 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.31.0
1.32.0
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.32.0] - 2024-04-29

- Updated timeout for Paradise updates redfish calls to 120 seconds

## [1.31.0] - 2024-04-16

- Fixed loader zip file error
Expand Down
2 changes: 1 addition & 1 deletion cmd/hms-firmware-action/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const manufacturerFoxconn = "foxconn"

const (
dfltMaxHTTPRetries = 5
dfltMaxHTTPTimeout = 40
dfltMaxHTTPTimeout = 120
dfltMaxHTTPBackoff = 8
)
const defaultS3Endpoint = "s3"
Expand Down
12 changes: 9 additions & 3 deletions cmd/hms-firmware-action/updateScheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ func doLaunch(operation storage.Operation, image storage.Image, command storage.
mainLogger.Debug(operation.HsmData.UpdateURI)
mainLogger.Debug(pcs)
passback = SendSecureRedfish(globals, operation.HsmData.FQDN, operation.HsmData.UpdateURI,
pcs, operation.HsmData.User, operation.HsmData.Password, "POST")
pcs, operation.HsmData.User, operation.HsmData.Password, "POST", 120)
if !(passback.IsError || passback.StatusCode >= 400) {
// Foxconn return a link to a task which we can monitor for update progress
tasklink := new(model.TaskLink)
Expand Down Expand Up @@ -1080,7 +1080,13 @@ func fileCheck(fileLocation string) (returnLocation string, err error) {
}

func SendSecureRedfish(globals *domain.DOMAIN_GLOBALS, server string, path string, bodyStr string, authUser string,
authPass string, method string) (pb model.Passback) {
authPass string, method string, timeout_override ...int) (pb model.Passback) {

timeout := 40
if len(timeout_override) > 0 {
timeout = timeout_override[0]
}
mainLogger.WithFields(logrus.Fields{"Timeout": timeout}).Debug("TIMEOUT SETTING")

tmpURL, _ := url.Parse("https://" + server + path)
req, err := http.NewRequest(method, tmpURL.String(), bytes.NewBuffer([]byte(bodyStr)))
Expand All @@ -1093,7 +1099,7 @@ func SendSecureRedfish(globals *domain.DOMAIN_GLOBALS, server string, path strin
if !(authUser == "" && authPass == "") {
req.SetBasicAuth(authUser, authPass)
}
reqContext, _ := context.WithTimeout(context.Background(), time.Second*40)
reqContext, _ := context.WithTimeout(context.Background(), time.Second*time.Duration(timeout))
req = req.WithContext(reqContext)
if err != nil {
mainLogger.Error(err)
Expand Down
7 changes: 6 additions & 1 deletion internal/domain/version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* (C) Copyright [2020-2021] Hewlett Packard Enterprise Development LP
* (C) Copyright [2020-2024] Hewlett Packard Enterprise Development LP
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -477,6 +477,11 @@ func RetrieveTaskStatus(hd *hsm.HsmData, tasklink string) (stateStatus model.Tas
logrus.Error(err)
return
}
if resp.StatusCode >= 400 {
err = fmt.Errorf("Task Status Code: %d", resp.StatusCode)
logrus.Error(err)
return
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)
Expand Down
Loading