botmeta sanity: check migrated_to on non-existing file (#64551)

This commit is contained in:
Martin Krizek 2019-11-07 20:12:10 +01:00 committed by Brian Coca
parent e5c1de29a8
commit c4b83619a6

View file

@ -80,10 +80,11 @@ def main():
path_macros.append(macro)
# Ensure all `files` correspond to a file
for file in botmeta['files']:
for file, file_meta in botmeta['files'].items():
migrated = isinstance(file_meta, dict) and file_meta.get('migrated_to') is not None
for macro in path_macros:
file = file.replace('$' + macro, botmeta.get('macros', {}).get(macro, ''))
if not os.path.exists(file):
if not os.path.exists(file) and not migrated:
# Not a file or directory, though maybe the prefix to one?
# https://github.com/ansible/ansibullbot/pull/1023
if not glob.glob('%s*' % file):