Merge "change host_containers group names in inventory"

This commit is contained in:
Jenkins 2016-06-07 16:56:36 +00:00 committed by Gerrit Code Review
commit d4af3279e5
3 changed files with 14 additions and 3 deletions

View File

@ -231,7 +231,7 @@ def _build_container_hosts(container_affinity, container_hosts, type_and_name,
address = host_type_config.get('ip') address = host_type_config.get('ip')
# Create a host types containers group and append it to inventory # Create a host types containers group and append it to inventory
host_type_containers = '%s_containers' % host_type host_type_containers = '%s-host_containers' % host_type
append_if(array=container_mapping, item=host_type_containers) append_if(array=container_mapping, item=host_type_containers)
hostvars_options.update({ hostvars_options.update({
@ -373,7 +373,7 @@ def _add_container_hosts(assignment, config, container_name, container_type,
) )
physical_host = inventory['_meta']['hostvars'][host_type] physical_host = inventory['_meta']['hostvars'][host_type]
container_host_type = '%s_containers' % host_type container_host_type = '%s-host_containers' % host_type
if 'container_types' not in physical_host: if 'container_types' not in physical_host:
physical_host['container_types'] = container_host_type physical_host['container_types'] = container_host_type
elif physical_host['container_types'] != container_host_type: elif physical_host['container_types'] != container_host_type:

View File

@ -0,0 +1,11 @@
---
fixes:
- Changed the way we name host containers groups in
dynamic_inventory.py for a hostname from
hostname_containers to hostname-host_containers to
prevent failing in the case where containers groups
have the same name as host containers when choosing
hostnames inspired from containers group names. This
change fixes the following bugs
https://bugs.launchpad.net/openstack-ansible/+bug/1512883 and
https://bugs.launchpad.net/openstack-ansible/+bug/1528953.

View File

@ -69,7 +69,7 @@ class TestAnsibleInventoryFormatConstraints(unittest.TestCase):
inventory = None inventory = None
expected_groups = [ expected_groups = [
'aio1_containers', 'aio1-host_containers',
'all', 'all',
'all_containers', 'all_containers',
'aodh_alarm_evaluator', 'aodh_alarm_evaluator',