container-puppet: update 'env' when not null

Only update "env" if the content isn't null otherwise we'll have
container configs with:
"environment": null

And it causes problem later when we manipulate the config.

Change-Id: I0269a7ad0cf54e75dd25f8b3566ac0cab06fd93c
This commit is contained in:
Emilien Macchi 2019-11-07 15:14:13 +01:00 committed by Alex Schultz
parent ccf1bca97c
commit c01f383ea0
1 changed files with 3 additions and 6 deletions

View File

@ -378,14 +378,11 @@ def infile_processing(infiles):
) )
# When python 27 support is removed, we will be able to use: # When python 27 support is removed, we will be able to use:
# z = {**x, **y} to merge the dicts. # z = {**x, **y} to merge the dicts.
infile_data.get( if infile_data.get('environment', None) is None:
'environment', infile_data['environment'] = {}
{} infile_data['environment'].update(
).update(
{'TRIPLEO_CONFIG_HASH': config_hash} {'TRIPLEO_CONFIG_HASH': config_hash}
) )
env = infile_data.get('environment')
infile_data['environment'] = env
outfile = os.path.join( outfile = os.path.join(
os.path.dirname( os.path.dirname(