Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed May 31, 2022
1 parent 6dbd4f3 commit e31e668
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def generate_device_manifest(
device_file_data = device_file.read()
device_file_md5 = hashlib.md5(device_file_data).hexdigest()
devices_manifest[device_name] = device_file_md5
flush_print(f"Manifest for {device_name} : {device_file_md5}")
flush_print(f"Current digest for {device_name} : {device_file_md5}")
if write_manifest_file:
device_zzz_dir_root = os.path.join(_CHEF_ZZZ_ROOT, device_name)
device_zzz_md5_file = os.path.join(device_zzz_dir_root, _CI_DEVICE_MANIFEST_NAME)
Expand Down 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 = """Cached files out of date!
fix_instructions = """
Cached files out of date!
Please:
./scripts/bootstrap.sh
source ./scripts/activate.sh
Expand All @@ -291,18 +292,18 @@ 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 - {fix_instructions}")
flush_print(f"NOT IN MANIFEST {device} - {fix_instructions}")
elif cached_device_manifest[device] != device_md5:
flush_print(f"MANIFEST MISMATCH - {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 {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 - {fix_instrucitons}")
flush_print(f"MISMATCH OUTPUT {device} - {fix_instrucitons}")
exit(1)
if False:
# Disabled; should check:
Expand Down

0 comments on commit e31e668

Please sign in to comment.