Skip to content

Commit

Permalink
Closes-Bug: #1566558 : New params name change caused error in Externa…
Browse files Browse the repository at this point in the history
…l Openstack Support

The name change meant the validation was broken
Related-Bug: #1588999

Patch 2:
Error in setting variables

Change-Id: I4337663cc7a0cfda732692016a992320fb15c927
  • Loading branch information
nitishkrishna committed Jun 21, 2016
1 parent 63300ba commit 411dfb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
16 changes: 11 additions & 5 deletions src/server_mgr_main.py
Expand Up @@ -861,7 +861,11 @@ 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_ip = cluster_openstack_params.get("keystone_ip", None)
configured_external_keystone_params = cluster_openstack_params.get("keystone", None)
if configured_external_keystone_params:
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
else:
configured_external_keystone_ip = None
configured_nova_params = cluster_openstack_params.get("nova", None)
if configured_nova_params:
configured_nova_rabbit_servers = configured_nova_params.get("rabbit_hosts", None)
Expand All @@ -870,7 +874,7 @@ def validate_non_openstack_cluster(self, cluster_id):
if configured_external_keystone_ip and configured_nova_rabbit_servers:
pass
else:
msg = "In a Cluster with no Openstack role, you need to configure both openstack::keystone_ip and openstack::nova::rabbit_hosts to point to an external Openstack\n"
msg = "In a Cluster with no Openstack role, you need to configure both openstack::keystone::ip and openstack::nova::rabbit_hosts to point to an external Openstack\n"
self.log_and_raise_exception(msg)

def validate_openstack_only_cluster(self, cluster_id):
Expand Down Expand Up @@ -3847,14 +3851,15 @@ def storage_get_control_network_mask(
server_params = server.get('parameters', {})
cluster_openstack_prov_params = (
cluster_params.get("provision", {})).get("openstack", {})
configured_external_keystone_ip = cluster_openstack_prov_params.get("keystone_ip", None)
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", None)
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
openstack_ip = ''
self_ip = server.get("ip_address", "")
if configured_external_keystone_ip:
openstack_ip = configured_external_keystone_ip
elif self_ip in role_ips_dict['openstack']:
openstack_ip = self_ip
elif 'openstack' in role_ips_dict:
elif 'openstack' in role_ips_dict and len(role_ips_dict['openstack']):
openstack_ip = role_ips_dict['openstack'][0]
else:
msg = "Openstack role not defined for cluster AND External Openstack not configured in cluster parameters.\n " \
Expand Down Expand Up @@ -3969,7 +3974,8 @@ 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_ip = cluster_openstack_prov_params.get("keystone_ip", None)
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", None)
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
mysql_allowed_hosts = []
internal_vip = openstack_ha_params.get("internal_vip", None)
if internal_vip:
Expand Down
5 changes: 3 additions & 2 deletions src/server_mgr_puppet.py
Expand Up @@ -48,14 +48,15 @@ def storage_get_control_network_mask(self, provision_params,
#openstack_ip = cluster_params.get("internal_vip", None)
cluster_openstack_prov_params = (
cluster_params.get("provision", {})).get("openstack", {})
configured_external_keystone_ip = cluster_openstack_prov_params.get("keystone_ip", None)
configured_external_keystone_params = cluster_openstack_prov_params.get("keystone", None)
configured_external_keystone_ip = configured_external_keystone_params.get("ip", None)
openstack_ip = ''
self_ip = server.get("ip_address", "")
if configured_external_keystone_ip:
openstack_ip = configured_external_keystone_ip
elif self_ip in role_ips_dict['openstack']:
openstack_ip = self_ip
elif 'openstack' in role_ips_dict:
elif 'openstack' in role_ips_dict and len(role_ips_dict['openstack']):
openstack_ip = role_ips_dict['openstack'][0]
else:
msg = "Openstack role not defined for cluster AND External Openstack not configured in cluster parameters.\n " \
Expand Down

0 comments on commit 411dfb4

Please sign in to comment.