Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed May 31, 2022
1 parent 8692341 commit 1f570d4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def main(argv: Sequence[str]) -> None:
if options.validate_zzz:
flush_print(f"Validating\n{_CI_MANIFEST_FILE_NAME}\n{_CHEF_ZZZ_ROOT}\n",
with_border=True)
fix_instructions = """
fix_instructions = f"""
Cached files out of date!
Please:
./scripts/bootstrap.sh
Expand All @@ -281,8 +282,8 @@ def main(argv: Sequence[str]) -> None:
npm install
cd ../../..
./examples/chef/chef.py --generate_zzz
git add examples/chef/zzz_generated
git add examples/chef/cimanifes.json
git add {_CHEF_ZZZ_ROOT}
git add {_CI_MANIFEST_FILE_NAME}
Ensure you are running with the latest version of ZAP from master!"""
ci_manifest = generate_device_manifest()
with open(_CI_MANIFEST_FILE_NAME, "r", encoding="utf-8") as ci_manifest_file:
Expand All @@ -292,25 +293,25 @@ def main(argv: Sequence[str]) -> None:
zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device)
device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME)
if device not in cached_device_manifest:
flush_print(f"NOT IN MANIFEST {device} - {fix_instructions}")
flush_print(f"NOT IN MANIFEST {device}: {fix_instructions}")
elif cached_device_manifest[device] != device_md5:
flush_print(f"MANIFEST MISMATCH {device} - {fix_instructions}")
flush_print(f"MANIFEST MISMATCH {device}: {fix_instructions}")
exit(1)
elif not os.path.exists(device_md5_file):
flush_print(f"OUTPUT MISSING {device} - {fix_instructions}")
flush_print(f"OUTPUT MISSING {device}: {fix_instructions}")
exit(1)
else:
with open(device_md5_file, "r", encoding="utf-8") as md5_file:
output_cached_md5 = md5_file.read()
if output_cached_md5 != device_md5:
flush_print(f"MISMATCH OUTPUT {device} - {fix_instrucitons}")
flush_print(f"MISMATCH OUTPUT {device}: {fix_instrucitons}")
exit(1)
if False:
# Disabled; should check:
# Current branch when writing manifest
# Master in CI
flush_print("BAD ZAP VERSION - "+fix_instructions)
exit(1) # shoul only warn
flush_print("BAD ZAP VERSION: "+fix_instructions)
exit(1) # should only warn in output and not stop builds
flush_print("Cached ZAP output is up to date!")
exit(0)

Expand Down

0 comments on commit 1f570d4

Please sign in to comment.