From 6625ddd54bfa2f47b8e53aeb460840e84f2cd7ee Mon Sep 17 00:00:00 2001 From: nitishkrishna Date: Wed, 13 Jul 2016 15:40:14 -0700 Subject: [PATCH] Closes-Bug: #1602866 - Prevent Old Params Cluster from being added to 3.1 SM onwards This will show error message if we add cluster json without provision section in parameters. NEEDS TO GO IN AFTER UI SUPPORT OF NEW PARAMS Also changed how external_keystone_ip is calculated Change-Id: I279977f2579521af429726568096ea484abe029c --- src/server_mgr_main.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/server_mgr_main.py b/src/server_mgr_main.py index 04e040c3..a01352b3 100755 --- a/src/server_mgr_main.py +++ b/src/server_mgr_main.py @@ -810,6 +810,12 @@ def validate_smgr_put(self, validation_data, request, data=None, for item in remove_list: data.pop(item, None) + if 'parameters' in data and obj_name == 'cluster': + if 'provision' not in data['parameters']: + msg = ("Old Parameters format is no longer supported for cluster parameters. Please use the new format") + self._smgr_log.log(self._smgr_log.ERROR,msg) + self.log_and_raise_exception(msg) + if 'roles' in data: if 'storage-compute' in data['roles'] and 'compute' not in data['roles']: msg = "role 'storage-compute' needs role 'compute' in provision file" @@ -861,7 +867,7 @@ def validate_non_openstack_cluster(self, cluster_id): else: msg = "Cluster with only Openstack role is supported only with new cluster params format with Openstack section\n" self.log_and_raise_exception(msg) - configured_external_keystone_params = cluster_openstack_params.get("keystone", None) + configured_external_keystone_params = cluster_openstack_params.get("keystone", {}) if configured_external_keystone_params: configured_external_keystone_ip = configured_external_keystone_params.get("ip", None) else: @@ -3852,7 +3858,7 @@ def storage_get_control_network_mask( server_params = server.get('parameters', {}) cluster_openstack_prov_params = ( cluster_params.get("provision", {})).get("openstack", {}) - configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", None) + configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", {}) configured_external_keystone_ip = configured_external_keystone_params.get("ip", None) openstack_ip = '' self_ip = server.get("ip_address", "") @@ -3975,7 +3981,7 @@ def build_calculated_cluster_params( # Build mysql_allowed_hosts list contrail_ha_params = cluster_contrail_prov_params.get("ha", {}) openstack_ha_params = cluster_openstack_prov_params.get("ha", {}) - configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", None) + configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", {}) configured_external_keystone_ip = configured_external_keystone_params.get("ip", None) mysql_allowed_hosts = [] internal_vip = openstack_ha_params.get("internal_vip", None)