diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 26ad9a7865a105..4d26f1346f4815 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -116,7 +116,7 @@ def generate_device_manifest( Args: include_zap_submod: Include ZAP commit in manifest - write_manifest_file: Serialize manifest + write_manifest_file: Serialize manifest in file and tree Returns: Dict containing MD5 of device dir zap files. """ @@ -258,32 +258,34 @@ def main(argv: Sequence[str]) -> None: ci_manifest = generate_device_manifest(_DEVICE_FOLDER) with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file: cached_manifest = json.loads(ci_manifest_file.read()) - for device in ci_manifest: - if device != "zap_commit": - try: - if cached_manifest[device] != ci_manifest[device]: - print("MISMATCH INPUT - "+fix_instructions) - exit(1) - else: - zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) - device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME) - if not os.path.exists(device_md5_file): - print("MISSING RESULT - "+fix_instructions) - exit(1) - else: - with open(device_md5_file, "r", encoding="utf-8") as md5_file: - md5 = md5_file.read() - if ci_manifest[device] != md5: - print("MISMATCH OUTPUT - "+fix_instrucitons) - exit(1) - except KeyError: - print("MISSING DEVICE CACHE - "+fix_instructions) - exit(1) - if device == "zap_commit" and False: - # Disabled for now, ci_manifest above created without include_zap_submod, fails in CI env. + for device in ci_manifest: + if device != "zap_commit": + try: if cached_manifest[device] != ci_manifest[device]: - print("BAD ZAP VERSION - "+fix_instructions) + print("MISMATCH INPUT - "+fix_instructions) exit(1) + else: + zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) + device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME) + if not os.path.exists(device_md5_file): + print("MISSING RESULT - "+fix_instructions) + exit(1) + else: + with open(device_md5_file, "r", encoding="utf-8") as md5_file: + md5 = md5_file.read() + if ci_manifest[device] != md5: + print("MISMATCH OUTPUT - "+fix_instrucitons) + exit(1) + except KeyError: + print("MISSING DEVICE CACHE - "+fix_instructions) + exit(1) + # Disabled; should check: + # Current branch when writing manifest + # Master in CI + if device == "zap_commit" and False: + if cached_manifest[device] != ci_manifest[device]: + print("BAD ZAP VERSION - "+fix_instructions) + exit(1) print("Cached ZAP output is up to date!") exit(0)