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

Merging CASMCMS-9039 fix into master #335

Merged
merged 10 commits into from
Jul 12, 2024
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/bos/operators/filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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]
6 changes: 2 additions & 4 deletions src/bos/operators/utils/boot_image_metadata/factory.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 @@ -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):
Expand All @@ -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)
raise BootImageMetaDataUnknown(f"No BootImageMetaData class for type {path_type}")
2 changes: 1 addition & 1 deletion src/bos/operators/utils/clients/hsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
3 changes: 1 addition & 2 deletions src/bos/operators/utils/rootfs/__init__.py
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down Expand Up @@ -35,7 +35,6 @@
class ProviderNotImplemented(Exception):
"""
Raised when a user requests a Provider Provisioning mechanism that isn't yet supported
by BOA.
"""


Expand Down
6 changes: 4 additions & 2 deletions src/bos/server/controllers/v2/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/bos/server/controllers/v2/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 0 additions & 1 deletion src/bos/server/controllers/v2/sessiontemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading