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

CASMCMS-8978: Fix broken _matches_filter call in patch_v2_components_dict #133

Merged
merged 2 commits into from
May 7, 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.19.5] - 04/17/2024
### Fixed
- Fix broken `_matches_filter` call in `patch_v2_components_dict`.

## [1.19.5] - 04/17/2024
### Fixed
- Added missing `special_parameters` to `V3ConfigurationLayer` schema in API spec.
Expand Down
15 changes: 9 additions & 6 deletions src/server/cray/cfs/api/controllers/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,22 +298,25 @@ def patch_v2_components_dict(data):
for component_id in id_list:
component_data = DB.get(component_id)
if component_data:
components.append((component_id, component_data))
components.append(component_data)
else:
# On large scale systems, this response may be too large
# use v3 for smaller responses
components = [ (component_data["id"], component_data) for component_data in DB.get_all()[0] ]
components = DB.get_all()[0]

response = []
patch = data.get("patch", {})
if "id" in patch:
del patch["id"]
patch = dbutils.convert_data_from_v2(patch, V2Component)
patch = _set_auto_fields(patch)
for component_id, component_data in components:
if _matches_filter(component_data, status_list, filters.get("enabled", None),
filters.get("config_name", None), tag_list):
response_data = DB.patch(component_id, patch, _update_handler)
configs = configurations.Configurations()
component_filter = partial(_component_filter, config_details=False, configs=configs,
id_list=[], status_list=status_list, enabled=filters.get("enabled", None),
config_name=filters.get("config_name", None), tag_list=tag_list)
for component_data in components:
if component_filter(component_data):
response_data = DB.patch(component_data["id"], patch, _update_handler)
response.append(convert_component_to_v2(response_data))
return response, 200

Expand Down
Loading