Skip to content

Commit

Permalink
Merge pull request #263 from Cray-HPE/CASMCMS-8946-csm-1.4
Browse files Browse the repository at this point in the history
CASMCMS-8946: Correct two problems with operating on empty node lists
  • Loading branch information
mharding-hpe authored Mar 12, 2024
2 parents 850f133 + d4c2a25 commit eecbdc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ 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).

## [Unreleased]
### Fixed
- Update base operator to handle case where all nodes to act on have exceeded their retry limit
- Fix return value of CAPMC client power function when no nodes specified

## [2.0.30] - 03-08-2024
### Changed
Expand Down
5 changes: 4 additions & 1 deletion src/bos/operators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# MIT License
#
# (C) Copyright 2021-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2021-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 @@ -116,6 +116,9 @@ def _run(self) -> None:
LOGGER.info('Found {} components that require action'.format(len(components)))
if self.retry_attempt_field: # Only check for failed components if we track retries for this operator
components = self._handle_failed_components(components)
if not components:
LOGGER.debug('After removing components that exceeded their retry limit, 0 components require action')
return
for component in components: # Unset old errors components
component['error'] = ''
try:
Expand Down
6 changes: 4 additions & 2 deletions src/bos/operators/utils/clients/capmc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
# (C) Copyright 2021-2022, 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 @@ -386,7 +386,9 @@ def power(nodes: List, state: str, force: bool = True, session = None,
"""
if not nodes:
LOGGER.warning("power called without nodes; returning without action.")
return set(), {}
# Instantiating this with an empty dictionary is the equivalent of reporting
# no errors
return CapmcXnameOnOffReturnedError({})

valid_states = ["off", "on"]
state = state.lower()
Expand Down

0 comments on commit eecbdc2

Please sign in to comment.