Merge pull request #7755 from ninjadq/fix_rendering_none_in_jinja

Fix None rendered in jinja2
This commit is contained in:
Qian Deng 2019-05-10 14:59:21 +08:00 committed by GitHub
commit 286167ad74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,12 @@ def get_storage_provider_info(provider_name, provider_config):
# generate storage configuration section in yaml format # generate storage configuration section in yaml format
storage_provider_conf_list = [provider_name + ':'] storage_provider_conf_list = [provider_name + ':']
for config in provider_config_copy.items(): for config in provider_config_copy.items():
storage_provider_conf_list.append('{}: {}'.format(*config)) if config[1] is None:
value = ''
elif config[1] == True:
value = 'true'
else:
value = config[1]
storage_provider_conf_list.append('{}: {}'.format(config[0], value))
storage_provider_info = ('\n' + ' ' * 4).join(storage_provider_conf_list) storage_provider_info = ('\n' + ' ' * 4).join(storage_provider_conf_list)
return storage_provider_info return storage_provider_info