Skip to content

Commit

Permalink
CASMCMS-9145: Rename arch_check_requires_ims to ims_errors_fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
mharding-hpe committed Oct 4, 2024
1 parent a736cee commit 592ab8c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
- Added `arch_check_requires_ims` BOS option. This determines whether or not a failure to
get IMS data is considered fatal when validating image architecture in a boot set. By default
this is false. Note that this has no effect for boot sets whose images are not in IMS, nor
for boot sets whose architecture is `Other`.
- Added `ims_errors_fatal` BOS option. This determines whether or not an IMS failure
is considered fatal even when BOS could continue despite the failure. Specifically,
this comes up when validating image architecture in a boot set. By default
this is false. Note that this has no effect for boot sets that:
- Have non-IMS images
- Have IMS images but the image does not exist in IMS
- Have `Other` architecture

### Changed
- Refactored some BOS Options code to use abstract base classes, to avoid code duplication.
Expand Down
2 changes: 1 addition & 1 deletion api/openapi.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ components:
session_limit_required:
type: boolean
description: If true, Sessions cannot be created without specifying the limit parameter.
arch_check_requires_ims:
ims_errors_fatal:
type: boolean
description: |
This option modifies how BOS behaves when validating the architecture of a boot image in a boot set.
Expand Down
10 changes: 5 additions & 5 deletions src/bos/common/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
# code should either import this dict directly, or (preferably) access
# its values indirectly using a DefaultOptions object
DEFAULTS = {
'arch_check_requires_ims': False,
'cleanup_completed_session_ttl': "7d",
'clear_stage': False,
'component_actual_state_ttl': "4h",
'default_retry_policy': 3,
'disable_components_on_completion': True,
'discovery_frequency': 300,
'ims_errors_fatal': False,
'logging_level': 'INFO',
'max_boot_wait_time': 1200,
'max_component_batch_size': 2800,
Expand All @@ -61,10 +61,6 @@ def get_option(self, key: str) -> Any:
# All these do is convert the response to the appropriate type for the option,
# and return it.

@property
def arch_check_requires_ims(self) -> bool:
return bool(self.get_option('arch_check_requires_ims'))

@property
def cleanup_completed_session_ttl(self) -> str:
return str(self.get_option('cleanup_completed_session_ttl'))
Expand All @@ -89,6 +85,10 @@ def disable_components_on_completion(self) -> bool:
def discovery_frequency(self) -> int:
return int(self.get_option('discovery_frequency'))

@property
def ims_errors_fatal(self) -> bool:
return bool(self.get_option('ims_errors_fatal'))

@property
def logging_level(self) -> str:
return str(self.get_option('logging_level'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def arch(self):
s3_url)
return None
try:
if self.options.arch_check_requires_ims:
if self.options.ims_errors_fatal:
image_data = get_image(ims_id)
else:
# If IMS being inaccessible is not a fatal error, then reduce the number
Expand All @@ -236,8 +236,8 @@ def arch(self):
return get_arch_from_image_data(image_data)
except Exception as err:
# If the image is not found, re-raise the exception
# If it's a different error, and arch_check_requires_ims is set, re-raise the exception
# If it's a different error, and ims_errors_fatal is set, re-raise the exception
# Otherwise, return None
if isinstance(err, ImageNotFound) or self.options.arch_check_requires_ims:
if isinstance(err, ImageNotFound) or self.options.ims_errors_fatal:
raise err
return None

0 comments on commit 592ab8c

Please sign in to comment.