Merge "Rename software deploy strategy, command and parameter"

This commit is contained in:
Zuul 2024-06-18 14:01:03 +00:00 committed by Gerrit Code Review
commit 4eaaee8e71
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