Skip to content

Commit

Permalink
clear allow list var
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed May 24, 2022
1 parent 0bc28e7 commit e007f0e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def main(argv: Sequence[str]) -> None:
chef_zzz_root = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated")
ci_manifest_file_name = os.path.join(_CHEF_SCRIPT_PATH, "cimanifest.json")
chef_devices_dir = os.path.join(_CHEF_SCRIPT_PATH, "devices")
ci_allowlist = ['lighting-app.zap']

#
# Validate zzz_generated
Expand All @@ -190,15 +191,15 @@ def main(argv: Sequence[str]) -> None:
print(f"Validating {chef_zzz_root}")
for device_dir_item in os.listdir(chef_devices_dir):
target_file_ext = ".zap"
if device_dir_item.endswith(target_file_ext) and device_dir_item == 'lightin\
g-app.zap':
if device_dir_item.endswith(target_file_ext) and device_dir_item in ci_allowlist:
device_name = device_dir_item[:-len(target_file_ext)]
device_file_path = os.path.join(chef_devices_dir, device_dir_item)
with open(device_file_path, "rb") as device_file:
device_file_data = device_file.read()
device_file_md5 = hashlib.md5(device_file_data).hexdigest()
ci_manifest[device_name] = device_file_md5
print(f"Manifest for {device_name} : {device_file_md5}")
# git ls-tree fails in CI
# git_cmd = ["git", "ls-tree", "master", "third_party/zap/repo"]
# zap_commit = str(subprocess.check_output(git_cmd, cwd=_REPO_BASE_PATH))
# zap_commit = zap_commit.split(" ")[2]
Expand All @@ -208,8 +209,7 @@ def main(argv: Sequence[str]) -> None:
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" and device == "lighting-app":
# Filter to one example
if device != "zap_commit":
if cached_manifest[device] != ci_manifest[device]:
print("Cached files out of date. Please run chef with the flag --generate_zzz and commit")
exit(1)
Expand Down Expand Up @@ -258,7 +258,7 @@ def main(argv: Sequence[str]) -> None:
print(f"Generating files in {chef_zzz_root} for all devices")
for device_dir_item in os.listdir(chef_devices_dir):
target_file_ext = ".zap"
if device_dir_item.endswith(target_file_ext) and device_dir_item == 'lighting-app.zap':
if device_dir_item.endswith(target_file_ext) and device_dir_item in ci_allowlist:
# Filter to one example
device_name = device_dir_item[:-len(target_file_ext)]
device_file_path = os.path.join(chef_devices_dir, device_dir_item)
Expand Down

0 comments on commit e007f0e

Please sign in to comment.