From d996947d252b0ea396c725622c610e5b2d920117 Mon Sep 17 00:00:00 2001 From: Tee Ngo Date: Tue, 22 Jan 2019 15:46:55 -0500 Subject: [PATCH] Improve robustness of helm-override-update - Allow the use of --reuse-values option in helm-override-update when there is no user overrides to be consistent with Helm. - Provide suggestion for correct usage of --set option. Tests done: The following commands were used to verify the changes: system helm-override-update neutron openstack \ --reuse-values --values /home/wrsroot/vlans.yaml system helm-override-delete neutron openstack system helm-override-update neutron openstack \ --set conf.plugins.ml2_conf.ml2_type_vlan.network_vlan_ranges=\ "physnet0:10:11,physnet0:1050:1099,physnet1:1100:1124" Story: 2004520 Task: 29035 Change-Id: Ic5d45f8e7e5e5df4b88468be2f7126c681a6e9cd Signed-off-by: Tee Ngo --- .../sysinv/sysinv/api/controllers/v1/helm_charts.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/helm_charts.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/helm_charts.py index deed1a55f0..5f46a4b5d2 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/helm_charts.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/helm_charts.py @@ -120,13 +120,22 @@ class HelmChartsController(rest.RestController): raise if flag == 'reuse': - file_overrides.insert(0, db_chart.user_overrides) + if db_chart.user_overrides is not None: + file_overrides.insert(0, db_chart.user_overrides) elif flag == 'reset': pass else: raise wsme.exc.ClientSideError(_("Invalid flag: %s must be either " "'reuse' or 'reset'.") % flag) + if set_overrides: + for overrides in set_overrides: + if ',' in overrides: + raise wsme.exc.ClientSideError( + _("Invalid input: One (or more) set overrides contains " + "multiple values. Consider using --values option " + "instead.")) + user_overrides = pecan.request.rpcapi.merge_overrides( pecan.request.context, file_overrides=file_overrides, set_overrides=set_overrides)