Skip to content

Commit

Permalink
CASMHMS-5248 Discovery errors (#65)
Browse files Browse the repository at this point in the history
* Added error to operations if device has an error

* Version to 1.15.0
  • Loading branch information
mbuchmann-hpe authored Dec 13, 2021
1 parent 391bee9 commit 7177444
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.15.0
1.16.0
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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.16.0] - 2021-12-10

### Changed

- Added error to operations if device has an error
- Reports error in operations stateHelper

## [1.15.0] - 2021-11-29

### Changed
Expand Down
32 changes: 20 additions & 12 deletions internal/domain/createUpdateList.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
"strings"
"time"

"github.com/google/uuid"
"github.com/sirupsen/logrus"
"github.com/Cray-HPE/hms-firmware-action/internal/hsm"
"github.com/Cray-HPE/hms-firmware-action/internal/model"
"github.com/Cray-HPE/hms-firmware-action/internal/storage"
"github.com/google/uuid"
"github.com/sirupsen/logrus"
)

//Create Update List for this Update ActionID and add to Master Update List
Expand Down Expand Up @@ -141,20 +141,26 @@ func GenerateOperations(actionID uuid.UUID) {
SetFirmwareVersion(&operation, &deviceMap)
//if candidateOperation
//STEP 7 -> try to lookup the actual images IDs!
FillInImageId(&operation, &imageMap, action.Parameters)
//if we have an error, set it to no solution and display an error message
if operation.Error != nil {
SetNoSolOp(&operation)
operation.StateHelper = "ERROR Found See Operation Details"
} else {
FillInImageId(&operation, &imageMap, action.Parameters)

//STEP 8 -> SetNoSolutionOperations!
// At this point, every candidate operation should have a ToImageID; if it doesnt then END IT!
SetNoSolOp(&operation)
//STEP 8 -> SetNoSolutionOperations!
// At this point, every candidate operation should have a ToImageID; if it doesnt then END IT!
SetNoSolOp(&operation)

//STEP 9 -> SetNoOperationOperations!
SetNoOpOp(&operation, action.Command.OverwriteSameImage)
//STEP 9 -> SetNoOperationOperations!
SetNoOpOp(&operation, action.Command.OverwriteSameImage)

//Not a NoSOl nor a NoOP
if operation.State.Can("configure") { //it has been configured; it is now READY to be 'started'
//TODO here is a good place to add in @DependencyManagment -> see develop @ tag: with-dependency to see what we had.
operation.State.Event("configure")
//Not a NoSOl nor a NoOP
if operation.State.Can("configure") { //it has been configured; it is now READY to be 'started'
//TODO here is a good place to add in @DependencyManagment -> see develop @ tag: with-dependency to see what we had.
operation.State.Event("configure")

}
}

err := (*GLOB.DSP).StoreOperation(operation)
Expand Down Expand Up @@ -361,6 +367,8 @@ func GetImageMap() (images map[uuid.UUID]storage.Image) {

func SetFirmwareVersion(candidateOperation *storage.Operation, deviceMap *map[string]storage.Device) {
if device, ok := (*deviceMap)[candidateOperation.Xname]; ok {
//if the device had an error, copy to operation
candidateOperation.Error = device.Error
for _, target := range device.Targets {
if target.Name == candidateOperation.Target && target.FirmwareVersion != "" {
candidateOperation.FromFirmwareVersion = target.FirmwareVersion
Expand Down

0 comments on commit 7177444

Please sign in to comment.