Skip to content

Commit

Permalink
CASMCMS-9143: When validating boot sets, check all boot sets for seve…
Browse files Browse the repository at this point in the history
…re errors before returning only warnings

(cherry picked from commit a1a9539)
  • Loading branch information
mharding-hpe committed Sep 26, 2024
1 parent b08c786 commit 676f7c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.10.26] - 2024-09-26
### Fixed
- When validating boot sets, check all boot sets for severe errors before returning only warnings

## [2.10.25] - 2024-08-25
### Dependencies
- Simplify how latest patch version of `liveness` is determined
Expand Down
9 changes: 5 additions & 4 deletions src/bos/server/controllers/v2/boot_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def validate_boot_sets(session_template: dict,
return BOOT_SET_ERROR, msg

hardware_specifier_fields = ('node_roles_groups', 'node_list', 'node_groups')
warning_flag = False
warn_msg = ""
for bs_name, bs in session_template['boot_sets'].items():
# Verify that the hardware is specified
specified = [bs.get(field, None)
Expand Down Expand Up @@ -100,8 +102,6 @@ def validate_boot_sets(session_template: dict,
LOGGER.error(msg)
return BOOT_SET_ERROR, msg

warning_flag = False
warn_msg = ""
for boot_artifact in ["initrd", "boot_parameters"]:
try:
artifact = getattr(image_metadata.boot_artifacts, boot_artifact)
Expand All @@ -118,7 +118,8 @@ def validate_boot_sets(session_template: dict,
LOGGER.warn(msg)
warning_flag = True
warn_msg = warn_msg + msg
if warning_flag:
return BOOT_SET_WARNING, warn_msg

if warning_flag:
return BOOT_SET_WARNING, warn_msg

return BOOT_SET_SUCCESS, "Valid"

0 comments on commit 676f7c8

Please sign in to comment.