From 1b35e59ffbb626d6baa69734cdf6868083630ea4 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Wed, 24 Jan 2018 22:58:27 -0800 Subject: [PATCH] Avoid explicit requirement for groups to exist The current templating for nova.conf checks if the 'inventory_hostname' of the current host is found within the combined lists of hosts for the default groups of all services other than nova-compute. This requires that each of those explicitly mentioned groups exist in the inventory and future upkeep if any of those default groups are renamed, added to, or removed. Instead, lookup each group defined in the 'nova_services' variable for all services other than nova-compute and check for an intersection of those groups and the current host's 'group_names'. Depends-On: https://review.openstack.org/540613 Change-Id: Ib3fe93e4f6a9f473a599cd4ac3e96ee9ac919108 --- templates/nova.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index c7da0edb..44064e70 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -210,7 +210,7 @@ token_cache_time = 300 memcache_security_strategy = ENCRYPT memcache_secret_key = {{ memcached_encryption_key }} -{% if inventory_hostname in (groups['nova_conductor'] + groups['nova_scheduler'] + groups['nova_api_os_compute'] + groups['nova_api_metadata'] + groups['nova_console'] + groups['nova_api_placement'])%} +{% if group_names | intersect(nova_services.keys() | difference('nova-compute') | map('extract', nova_services, 'group') | list) | count > 0 %} [database] connection = mysql+pymysql://{{ nova_galera_user }}:{{ nova_container_mysql_password }}@{{ nova_galera_address }}/{{ nova_galera_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %}