System host-upgrade has inadequate semantic checks
System host-upgrade prompts the user to confirm the operation on a SX for any hostname typed, this adds validation to the inputted argument and rejects the command if the hostname or id typed is invalid. Also added validation to host-downgrade and kube-host-upgrade. Tested on a SX, changing the cgts-client and the validation was sucessfull rejecting invalid ids and hostnames. Closes-bug: #1934806 Signed-off-by: Iago Regiani <Lago.RodriguezRegiani@windriver.com> Change-Id: Ia7f48fee1204e4e2178ef5a954621725512cc738
This commit is contained in:
parent
15b62819eb
commit
775c5c7672
@ -171,6 +171,7 @@ class HostTest(test_shell.ShellTest):
|
||||
|
||||
def test_kube_host_upgrade_control_plane(self):
|
||||
self.make_env()
|
||||
self.ihost_manager_list_result = [ihost(None, FAKE_IHOST_2, True)]
|
||||
self.kube_host_upgrade_manager_list_result = [
|
||||
KubeHostUpgrade(None, FAKE_KUBE_HOST_UPGRADE, True),
|
||||
KubeHostUpgrade(None, FAKE_KUBE_HOST_UPGRADE_2, True),
|
||||
@ -196,6 +197,7 @@ class HostTest(test_shell.ShellTest):
|
||||
|
||||
def test_kube_host_upgrade_kubelet(self):
|
||||
self.make_env()
|
||||
self.ihost_manager_list_result = [ihost(None, FAKE_IHOST_2, True)]
|
||||
self.kube_host_upgrade_manager_list_result = [
|
||||
KubeHostUpgrade(None, FAKE_KUBE_HOST_UPGRADE, True),
|
||||
KubeHostUpgrade(None, FAKE_KUBE_HOST_UPGRADE_2, True),
|
||||
|
@ -760,6 +760,7 @@ def do_host_bulk_export(cc, args):
|
||||
help="Force the downgrade operation ")
|
||||
def do_host_downgrade(cc, args):
|
||||
"""Perform software downgrade for the specified host."""
|
||||
ihost_utils._find_ihost(cc, args.hostid)
|
||||
system_type, system_mode = utils._get_system_info(cc)
|
||||
simplex = system_mode == constants.SYSTEM_MODE_SIMPLEX
|
||||
|
||||
@ -789,6 +790,7 @@ def do_host_downgrade(cc, args):
|
||||
help="Force the upgrade operation ")
|
||||
def do_host_upgrade(cc, args):
|
||||
"""Perform software upgrade for a host."""
|
||||
ihost_utils._find_ihost(cc, args.hostid)
|
||||
system_type, system_mode = utils._get_system_info(cc)
|
||||
simplex = system_mode == constants.SYSTEM_MODE_SIMPLEX
|
||||
|
||||
@ -822,6 +824,7 @@ def do_host_upgrade(cc, args):
|
||||
help="Force the kubernetes upgrade operation ")
|
||||
def do_kube_host_upgrade(cc, args):
|
||||
"""Perform kubernetes upgrade for a host."""
|
||||
ihost_utils._find_ihost(cc, args.hostid)
|
||||
|
||||
if args.component == 'control-plane':
|
||||
host = cc.ihost.kube_upgrade_control_plane(args.hostid, args.force)
|
||||
|
Loading…
Reference in New Issue
Block a user