diff --git a/CHANGELOG.md b/CHANGELOG.md index 48b816b8..23b1bb62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,17 @@ 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). -## [Unreleased] +## Unreleased + +## [2.21.0] + +### Fixed +- The applystage operation works again. It was broken when multi-tenancy support was added. +- Fix incorrect exception instantiation arguments in `boot_image_metadata/factory.py` + +### Removed +- Remove vestigial `BASEKEY` definition from sessions and templates server controller source files +- Remove unnecessary (and invalid) `__all__` assignment from `__init__.py` in filters module ## [2.20.0] - 2024-06-05 ### Fixed diff --git a/src/bos/operators/filters/__init__.py b/src/bos/operators/filters/__init__.py index b063e94c..a8eac696 100644 --- a/src/bos/operators/filters/__init__.py +++ b/src/bos/operators/filters/__init__.py @@ -2,7 +2,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"), @@ -27,7 +27,3 @@ from .filters import BOSQuery, HSMState, TimeSinceLastAction,\ LastActionIs, BootArtifactStatesMatch, DesiredConfigurationSetInCFS, DesiredBootStateIsNone,\ DesiredConfigurationIsNone, DesiredBootStateIsOff, OR, NOT, ActualStateAge, ActualBootStateIsSet - -__all__ = [BOSQuery, HSMState, TimeSinceLastAction, LastActionIs, BootArtifactStatesMatch, - DesiredConfigurationSetInCFS, DesiredBootStateIsNone, DesiredConfigurationIsNone, - DesiredBootStateIsOff, OR, NOT, ActualStateAge, ActualBootStateIsSet] diff --git a/src/bos/operators/utils/boot_image_metadata/factory.py b/src/bos/operators/utils/boot_image_metadata/factory.py index ac94cebd..c9aef39e 100644 --- a/src/bos/operators/utils/boot_image_metadata/factory.py +++ b/src/bos/operators/utils/boot_image_metadata/factory.py @@ -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"), @@ -31,7 +31,6 @@ class BootImageMetaDataUnknown(Exception): """ Raised when a user requests a Provider provisioning mechanism that is not known - by BOA. """ class BootImageMetaDataFactory(object): @@ -48,5 +47,4 @@ def __call__(self): if path_type == 's3': return S3BootImageMetaData(self.boot_set) else: - raise BootImageMetaDataUnknown("No BootImageMetaData class for " - "type %s", path_type) \ No newline at end of file + raise BootImageMetaDataUnknown(f"No BootImageMetaData class for type {path_type}") diff --git a/src/bos/operators/utils/clients/hsm.py b/src/bos/operators/utils/clients/hsm.py index a1b26c3c..f72fb3b6 100644 --- a/src/bos/operators/utils/clients/hsm.py +++ b/src/bos/operators/utils/clients/hsm.py @@ -151,7 +151,7 @@ class Inventory(object): Inventory handles the generation of a hardware inventory in a similar manner to how the dynamic inventory is generated for CFS. To reduce the number of calls to HSM, everything is cached for repeated checks, stored both as overall inventory and separate group types to allow - use in finding BOA's base list of nodes, and lazily loaded to prevent extra calls when no limit + use in finding BOS's base list of nodes, and lazily loaded to prevent extra calls when no limit is used. """ diff --git a/src/bos/operators/utils/rootfs/__init__.py b/src/bos/operators/utils/rootfs/__init__.py index 44db882c..d00f90c5 100644 --- a/src/bos/operators/utils/rootfs/__init__.py +++ b/src/bos/operators/utils/rootfs/__init__.py @@ -1,7 +1,7 @@ # # MIT License # -# (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP +# (C) Copyright 2019-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"), @@ -35,7 +35,6 @@ class ProviderNotImplemented(Exception): """ Raised when a user requests a Provider Provisioning mechanism that isn't yet supported - by BOA. """ diff --git a/src/bos/server/controllers/v2/components.py b/src/bos/server/controllers/v2/components.py index e32b0499..e81805ce 100644 --- a/src/bos/server/controllers/v2/components.py +++ b/src/bos/server/controllers/v2/components.py @@ -25,7 +25,7 @@ import logging from bos.common.utils import exc_type_msg, get_current_timestamp -from bos.common.tenant_utils import get_tenant_from_header, get_tenant_component_set, tenant_error_handler +from bos.common.tenant_utils import get_tenant_from_header, get_tenant_component_set, tenant_error_handler, get_tenant_aware_key from bos.common.values import Phase, Action, Status, EMPTY_STAGED_STATE, EMPTY_BOOT_ARTIFACTS from bos.server import redis_db_utils as dbutils from bos.server.controllers.v2.options import get_v2_options_data @@ -504,7 +504,9 @@ def _apply_staged(component_id, clear_staged=False): def _set_state_from_staged(data): staged_state = data.get("staged_state", {}) - staged_session_id = staged_state.get("session", "") + staged_session_id_sans_tenant = staged_state.get("session", "") + tenant = get_tenant_from_header() + staged_session_id = get_tenant_aware_key(staged_session_id_sans_tenant, tenant) if staged_session_id not in SESSIONS_DB: raise Exception("Staged session no longer exists") session = SESSIONS_DB.get(staged_session_id) diff --git a/src/bos/server/controllers/v2/sessions.py b/src/bos/server/controllers/v2/sessions.py index dda45e0d..5ce0edc9 100644 --- a/src/bos/server/controllers/v2/sessions.py +++ b/src/bos/server/controllers/v2/sessions.py @@ -44,7 +44,6 @@ DB = dbutils.get_wrapper(db='sessions') COMPONENTS_DB = dbutils.get_wrapper(db='components') STATUS_DB = dbutils.get_wrapper(db='session_status') -BASEKEY = "/sessions" MAX_COMPONENTS_IN_ERROR_DETAILS = 10 diff --git a/src/bos/server/controllers/v2/sessiontemplates.py b/src/bos/server/controllers/v2/sessiontemplates.py index 6332969e..6f86d3ea 100644 --- a/src/bos/server/controllers/v2/sessiontemplates.py +++ b/src/bos/server/controllers/v2/sessiontemplates.py @@ -33,7 +33,6 @@ LOGGER = logging.getLogger('bos.server.controllers.v2.sessiontemplates') DB = dbutils.get_wrapper(db='session_templates') -BASEKEY = "/sessionTemplates" EXAMPLE_BOOT_SET = { "type": "s3",