From c4b83619a69b0cb2ae34e682966380b41f9a6dd3 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Thu, 7 Nov 2019 20:12:10 +0100 Subject: [PATCH] botmeta sanity: check migrated_to on non-existing file (#64551) --- test/sanity/code-smell/botmeta.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/sanity/code-smell/botmeta.py b/test/sanity/code-smell/botmeta.py index 7ae48d67e5f..48660a06441 100755 --- a/test/sanity/code-smell/botmeta.py +++ b/test/sanity/code-smell/botmeta.py @@ -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):