
This commit implements the software deploy active-rollback command. When deploy abort is executed after deploy activate, this command is need to follow to deploy host-rollback. It will execute the upgrade scripts with action activate-rollback. Deploy state is changed to "activate-rollback-pending" after deploy abort, updated to "activate-rollback" when activate-rollback is in progress and is updated to "activate-rollback-done" when it completes with success and "activate-rollback-failed" otherwise. This commit also make some changes to the scripts log at software.log file. Test Plan: PASS: activate-rollback with major release completed successfully PASS: activate-rollback with major release failed PASS: activate-rollback with major release after command failed PASS: log related to activate_rollback is registered on software.log Story: 2010676 Task: 50297 Change-Id: I5ede23229e0217f6eb98e27570be4ff40fdafdd8 Signed-off-by: Luis Eduardo Bonatti <LuizEduardo.Bonatti@windriver.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
#
|
|
# Copyright (c) 2013-2024 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
#
|
|
|
|
from software_client.common import utils
|
|
from software_client.v1 import deploy_shell
|
|
|
|
|
|
DEPLOY_COMMAND_MODULES = [
|
|
deploy_shell,
|
|
]
|
|
|
|
# sofware deploy commands
|
|
# - precheck
|
|
# - start
|
|
# - host
|
|
# - abort
|
|
# - activate
|
|
# - activate-rollback
|
|
# - complete
|
|
# - delete
|
|
# non root/sudo users can run:
|
|
# - host-list
|
|
# - show
|
|
# Deploy commands are region_restricted, which means
|
|
# that they are not permitted to be run in DC
|
|
#
|
|
# UN_RESTRICTED_COMMANDS is used to set argparser argument 'restricted' to False
|
|
UN_RESTRICTED_COMMANDS = ['show', 'host-list']
|
|
|
|
|
|
def enhance_parser(parser, subparsers, cmd_mapper):
|
|
'''Take a basic (nonversioned) parser and enhance it with
|
|
commands and options specific for this version of API.
|
|
|
|
:param parser: top level parser :param subparsers: top level
|
|
parser's subparsers collection where subcommands will go
|
|
'''
|
|
for command_module in DEPLOY_COMMAND_MODULES:
|
|
utils.define_commands_from_module(subparsers, command_module,
|
|
cmd_mapper, UN_RESTRICTED_COMMANDS)
|