Ensure Boolean Strings from the environment are treated correctly

This happens because we use six.text_type() to convert the oslo.config
options into a strings so we can pass it via environment
variables[1,2,3].

[1] http://git.openstack.org/cgit/openstack/instack-undercloud/tree/instack_undercloud/undercloud.py#n1229
[2] http://git.openstack.org/cgit/openstack/instack-undercloud/tree/instack_undercloud/undercloud.py#n1371
[3] http://git.openstack.org/cgit/openstack/instack-undercloud/tree/instack_undercloud/undercloud.py#n550

Change-Id: I5830a856960856af1a045d6eda609b8abb20658d
Closes-Bug: 1743679
This commit is contained in:
Tony Breeds 2018-01-17 14:16:09 +11:00
parent 5dd4e93f59
commit 28fd522886

View File

@ -36,6 +36,13 @@ for k, v in os.environ.items():
endpoint_context[k] = v
context.update(endpoint_context)
# Make sure boolean strings are treated as Bool()
for k, v in list(context.items()):
if v == 'False':
context[k] = False
elif v == 'True':
context[k] = True
with open(template) as f:
puppet_stack_config_yaml = renderer.render(f.read(), context)