Rename software deploy strategy, command and parameter

This commit renames the following to be consistent with other
repos:

- Command from `software-deploy-strategy` to `sw-deploy-strategy`
- Strategy from `software` to `sw-deploy`
- Parameter `release-id` to `release`

The `release` parameter is now positional and no longer optional.

Test Plan:
PASS - Perform a software deploy strategy

Story: 2010676
Task: 50355

Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/921520

Change-Id: I6a8aa404286e1809277b8d560aa5665f054e3da2
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit is contained in:
Hugo Brito 2024-06-07 09:27:20 -03:00 committed by Hugo Nicodemos
parent 0e7b4f5d93
commit 06b317b67a
4 changed files with 14 additions and 15 deletions

View File

@ -6,7 +6,7 @@
from dcmanagerclient.api.v1.sw_update_manager import SwUpdateManager
SW_UPDATE_TYPE_USM = "software"
SW_UPDATE_TYPE_USM = "sw-deploy"
class SwDeployManager(SwUpdateManager):

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_id")
release_id = sw_update_strategy.extra_args.get("release")
# Find the index of 'stop on failure' in the tuple
failure_status_index = columns.index("stop on failure")
@ -58,16 +58,15 @@ class CreateSwDeployStrategy(
parser = super().get_parser(prog_name)
parser.add_argument(
"--release-id",
required=True,
help="The release to be deployed.",
"release",
help="The release ID to be deployed.",
)
return parser
def process_custom_params(self, parsed_args, kwargs_dict):
"""Updates kwargs dictionary from parsed_args for patching"""
kwargs_dict["release_id"] = parsed_args.release_id
kwargs_dict["release"] = parsed_args.release
# override validate_force_params defined in CreateSwUpdateStrategy
def validate_force_params(self, parsed_args):

View File

@ -580,11 +580,6 @@ class DCManagerShell(app.App):
"prestage-strategy create": spr.CreateSwPrestageStrategy,
"prestage-strategy delete": spr.DeleteSwPrestageStrategy,
"prestage-strategy show": spr.ShowSwPrestageStrategy,
"software-deploy-strategy abort": swdm.AbortSwDeployStrategy,
"software-deploy-strategy apply": swdm.ApplySwDeployStrategy,
"software-deploy-strategy create": swdm.CreateSwDeployStrategy,
"software-deploy-strategy delete": swdm.DeleteSwDeployStrategy,
"software-deploy-strategy show": swdm.ShowSwDeployStrategy,
"strategy-step list": swum.ListSwUpdateStrategyStep,
"strategy-step show": swum.ShowSwUpdateStrategyStep,
"strategy-config delete": suom.DeleteSwUpdateOptions,
@ -634,6 +629,11 @@ class DCManagerShell(app.App):
"subcloud-peer-group show": pm.ShowSubcloudPeerGroup,
"subcloud-peer-group status": pm.StatusSubcloudPeerGroup,
"subcloud-peer-group update": pm.UpdateSubcloudPeerGroup,
"sw-deploy-strategy abort": swdm.AbortSwDeployStrategy,
"sw-deploy-strategy apply": swdm.ApplySwDeployStrategy,
"sw-deploy-strategy create": swdm.CreateSwDeployStrategy,
"sw-deploy-strategy delete": swdm.DeleteSwDeployStrategy,
"sw-deploy-strategy show": swdm.ShowSwDeployStrategy,
"system-peer add": sp.AddSystemPeer,
"system-peer delete": sp.DeleteSystemPeer,
"system-peer list": sp.ListSystemPeer,

View File

@ -26,7 +26,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-id"""
"""Test deploy strategy should be created with release"""
# prepare mixin attributes
manager_to_test = self.sw_update_manager
@ -35,7 +35,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_id": "stx-24.09.1"},
extra_args={"release": "stx-24.09.1"},
)
# mock that there is no pre-existing strategy
@ -44,7 +44,7 @@ class TestSwDeployStrategy(UpdateStrategyMixin, base.BaseCommandTest):
# invoke the backend method for the CLI.
# Returns a tuple of field descriptions, and a second tuple of values
fields, results = self.call(
self.create_command, ["--release-id", "stx-24.09.1"]
self.create_command, ["stx-24.09.1"]
)
# results is a tuple of expected length
@ -64,7 +64,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-id"""
"""Test deploy strategy should not be created without release"""
# prepare mixin attributes
manager_to_test = self.sw_update_manager