Fixing app name when searching for apply modes
After performing a platform backup with stx-openstack application applied, when trying to restore the application it fails due to an unsupported application-apply mode (--mode restore_db). This issue was probably introduced after changing code on sysinv to use general naming for Openstack application [1]. It is probably a remaining work that was left behind on that time. Now when the app name is checked to be valid inside HELM_APP_APPLY_MODES it is never validated since the mode is now referring to HELM_APP_OPENSTACK='openstack'. This change is simply checking if the app being patched has a name that ends with the constant HELM_APP_OPENSTACK. If it is the case, then we are handling an Openstack application and the mode_name to be searched can simply be the constat it self. Otherwise we consider the mode_name as the name argument and the function behaves as it is behaving now. TEST PLAN: PASS: Build & Install on an AIO-SX system PASS: Execute stx-openstack application backup procedure [2] successfully PASS: Execute stx-openstack application restore procedure [2] successfully [1] https://review.opendev.org/c/starlingx/config/+/814670 [2] https://docs.starlingx.io/developer_resources/backup_restore.html Closes-bug: 1961435 Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com> Change-Id: I9423da249ddc74228111ba2b954afe7b93c505d7
This commit is contained in:
parent
05a78bfa35
commit
c53d555e2d
|
@ -279,20 +279,22 @@ class KubeAppController(rest.RestController):
|
|||
raise wsme.exc.ClientSideError(_(
|
||||
"Application-{} rejected: application not found.".format(directive)))
|
||||
|
||||
plugin_name = cutils.find_app_plugin_name(name)
|
||||
|
||||
if directive == 'apply':
|
||||
if not values:
|
||||
mode = None
|
||||
elif name not in constants.HELM_APP_APPLY_MODES:
|
||||
elif plugin_name not in constants.HELM_APP_APPLY_MODES:
|
||||
raise wsme.exc.ClientSideError(_(
|
||||
"Application-apply rejected: Mode is not supported "
|
||||
"for app {}.".format(name)))
|
||||
elif (values['mode'] and
|
||||
values['mode'] not in constants.HELM_APP_APPLY_MODES[name]):
|
||||
values['mode'] not in constants.HELM_APP_APPLY_MODES[plugin_name]):
|
||||
raise wsme.exc.ClientSideError(_(
|
||||
"Application-apply rejected: Mode {} for app {} is not "
|
||||
"valid. Valid modes are {}.".format(
|
||||
values['mode'], name,
|
||||
constants.HELM_APP_APPLY_MODES[name])))
|
||||
constants.HELM_APP_APPLY_MODES[plugin_name])))
|
||||
else:
|
||||
mode = values['mode']
|
||||
|
||||
|
|
Loading…
Reference in New Issue