Template api/registry enablement settings properly

If a deployer sets the boolean vars to 'yes', 'no' or
other equivalent booleans valid for ansible, the glance
services will currently use those in the .conf files
and it will break.

This patch ensures that we cast the output into the
.conf files properly so that regardless of the input,
the output is correct.

The tests are adjusted to deliberately use one of the
Ansible boolean values instead of a python boolean to
validate that this works.

Change-Id: I267b97da618bbda05140d2a0332798fc77db06a5
This commit is contained in:
Jesse Pretorius 2017-11-21 09:38:41 +00:00
parent 6534ebe2e0
commit 4e0c72cfe9
3 changed files with 10 additions and 10 deletions

View File

@ -17,10 +17,10 @@ registry_port = {{ glance_registry_service_port }}
registry_client_protocol = {{ glance_service_registry_proto }}
cinder_catalog_info = volume:cinder:internalURL
enable_v1_api = {{ glance_enable_v1_api }}
enable_v1_registry = {{ glance_enable_v1_api }}
enable_v2_api = {{ glance_enable_v2_api }}
enable_v2_registry = {{ glance_enable_v2_registry }}
enable_v1_api = {{ glance_enable_v1_api | bool }}
enable_v1_registry = {{ glance_enable_v1_api | bool }}
enable_v2_api = {{ glance_enable_v2_api | bool }}
enable_v2_registry = {{ glance_enable_v2_registry | bool }}
{% if glance_enable_v2_registry | bool %}
data_api = glance.db.registry.api

View File

@ -14,10 +14,10 @@ workers = {{ glance_registry_workers | default(glance_api_threads) }}
api_limit_max = 1000
limit_param_default = 25
enable_v1_api = {{ glance_enable_v1_api }}
enable_v1_registry = {{ glance_enable_v1_api }}
enable_v2_api = {{ glance_enable_v2_api }}
enable_v2_registry = {{ glance_enable_v2_registry }}
enable_v1_api = {{ glance_enable_v1_api | bool }}
enable_v1_registry = {{ glance_enable_v1_api | bool }}
enable_v2_api = {{ glance_enable_v2_api | bool }}
enable_v2_registry = {{ glance_enable_v2_registry | bool }}
transport_url = rabbit://{% for host in glance_rabbitmq_servers.split(',') %}{{ glance_rabbitmq_userid }}:{{ glance_rabbitmq_password }}@{{ host }}:{{ glance_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ glance_rabbitmq_vhost }}{% endif %}{% endfor %}

View File

@ -119,7 +119,7 @@ deps =
{[testenv:ansible]deps}
setenv =
{[testenv]setenv}
ANSIBLE_PARAMETERS=-e glance_enable_v1_api=True
ANSIBLE_PARAMETERS=-e glance_enable_v1_api=yes
commands =
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
@ -130,7 +130,7 @@ deps =
{[testenv:ansible]deps}
setenv =
{[testenv]setenv}
ANSIBLE_PARAMETERS=-e glance_enable_v2_registry=True
ANSIBLE_PARAMETERS=-e glance_enable_v2_registry=yes
commands =
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"