Exports cm and j2 imports should be ordered

Otherwise it brakes updates (rolling updates are being
triggered without a reason)

Change-Id: I9fc0499e8a52b39f8ec5acceca5483524104782e
This commit is contained in:
Andrey Pavlov 2017-02-26 16:47:06 +00:00
parent 9753958d02
commit be5afcc512
2 changed files with 6 additions and 4 deletions

View File

@ -62,4 +62,4 @@ def generate_jinja_imports(exports_map):
'python compatible naming' % (name, import_as))
imports.append(
"{% import '" + name + "' as " + import_as + " with context %}")
return ''.join(imports)
return ''.join(sorted(imports))

View File

@ -105,10 +105,12 @@ def get_repositories_exports():
path = os.path.join(exports_dir, export_file)
LOG.debug('Found shared jinja template file %s', path)
if cm_key not in exports:
exports[cm_key] = {'name': export_file, 'body': ''}
# Merge the files with same name
exports[cm_key] = {'name': export_file, 'body': []}
with open(path) as f:
exports[cm_key]['body'] += f.read() + '\n'
exports[cm_key]['body'].append(f.read())
for cm_key, cm in exports.items():
# Merge files with the same name
cm['body'] = '\n'.join(sorted(cm['body']))
return exports