Rename sw-deploy-strategy release parameter to release_id

To avoid conflicts with the --release parameter used to
retrieve the software version, this commit changes the sw-deploy
positional parameter to release_id.

TEST PLAN:
PASS - Create a sw-deploy-strategy using <release_id>
Failure Path:
PASS - Create a sw-deploy-strategy without <release_id>
  - error: the following arguments are required: release_id

Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/923894

Story: 2010676
Task: 50355

Change-Id: Idbbddd95f4a1f9b2a8af812c5856c4da05c12479
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit is contained in:
Hugo Brito 2024-07-10 17:01:23 -03:00 committed by Hugo Nicodemos
parent b723090265
commit 4ac85ea810
3 changed files with 7 additions and 7 deletions

View File

@ -12,5 +12,5 @@ SW_UPDATE_TYPE_USM = "sw-deploy"
class SwDeployManager(SwUpdateManager):
def __init__(self, http_client):
super().__init__(
http_client, update_type=SW_UPDATE_TYPE_USM, extra_args=["release"]
http_client, update_type=SW_UPDATE_TYPE_USM, extra_args=["release_id"]
)

View File

@ -19,7 +19,7 @@ class SwDeployManagerMixin:
columns, data = original_fmt_func(sw_update_strategy)
release_id = ""
if sw_update_strategy and sw_update_strategy.extra_args:
release_id = sw_update_strategy.extra_args.get("release")
release_id = sw_update_strategy.extra_args.get("release_id")
# Find the index of 'stop on failure' in the tuple
failure_status_index = columns.index("stop on failure")
@ -58,7 +58,7 @@ class CreateSwDeployStrategy(
parser = super().get_parser(prog_name)
parser.add_argument(
"release",
"release_id",
help="The release ID to be deployed.",
)
@ -66,7 +66,7 @@ class CreateSwDeployStrategy(
def process_custom_params(self, parsed_args, kwargs_dict):
"""Updates kwargs dictionary from parsed_args for patching"""
kwargs_dict["release"] = parsed_args.release
kwargs_dict["release_id"] = parsed_args.release_id
# override validate_force_params defined in CreateSwUpdateStrategy
def validate_force_params(self, parsed_args):

View File

@ -25,7 +25,7 @@ class TestSwDeployStrategy(UpdateStrategyMixin, base.BaseCommandTest):
self.abort_command = cli_cmd.AbortSwDeployStrategy
def test_create_strategy(self):
"""Test deploy strategy should be created with release"""
"""Test deploy strategy should be created with release_id"""
# prepare mixin attributes
manager_to_test = self.sw_update_manager
@ -34,7 +34,7 @@ class TestSwDeployStrategy(UpdateStrategyMixin, base.BaseCommandTest):
# mock the result of the API call
strategy = utils.make_strategy(
strategy_type=expected_strategy_type,
extra_args={"release": "stx-24.09.1"},
extra_args={"release_id": "stx-24.09.1"},
)
# mock that there is no pre-existing strategy
@ -61,7 +61,7 @@ class TestSwDeployStrategy(UpdateStrategyMixin, base.BaseCommandTest):
self.assertEqual(results[failure_index + 1], "stx-24.09.1")
def test_create_strategy_without_release_id(self):
"""Test deploy strategy should not be created without release"""
"""Test deploy strategy should not be created without release_id"""
# prepare mixin attributes
manager_to_test = self.sw_update_manager