Skip to content

Commit

Permalink
Remove functionality to check master branch for zap
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed Jun 2, 2022
1 parent 2a79c1c commit 02f3e78
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,16 @@ def check_python_version() -> None:
exit(1)


def check_zap(master: bool = False) -> str:
"""Produces hash of ZAP submodule.
def check_zap() -> str:
"""Produces SHA of ZAP submodule for current HEAD.
Args:
master: Check branch master instead of current branch.
Returns:
SHA of zap submodule.
"""
shell.run_cmd(f"cd {_REPO_BASE_PATH}")
if master:
flush_print("Fetching master")
command = "git fetch origin master --depth=1 --recurse-submodules"
shell.run_cmd(command)
branch = "origin/master"
else:
branch = shell.run_cmd("git rev-parse --abbrev-ref HEAD",
return_cmd_output=True).replace("\n", "")
branch = shell.run_cmd("git rev-parse --abbrev-ref HEAD",
return_cmd_output=True)
branch = branch.replace("\n", "")
command = f"git ls-tree {branch} third_party/zap/repo"
zap_commit = shell.run_cmd(command, return_cmd_output=True)
zap_commit = zap_commit.split(" ")[2]
Expand All @@ -123,19 +116,17 @@ def check_zap(master: bool = False) -> str:


def generate_device_manifest(
write_manifest_file: bool = False,
zap_check_master: bool = False) -> Dict[str, Any]:
write_manifest_file: bool = False) -> Dict[str, Any]:
"""Produces dictionary containing md5 of device dir zap files.
Args:
write_manifest_file: Serialize manifest in file and tree.
zap_check_master: Check master instead of HEAD for zap.
write_manifest_file: Serialize manifest in tree.
Returns:
Dict containing MD5 of device dir zap files.
"""
ci_manifest = {"devices": {}}
devices_manifest = ci_manifest["devices"]
zap_sha = check_zap(master=zap_check_master)
zap_sha = check_zap()
ci_manifest["zap_commit"] = zap_sha
for device_name in _DEVICE_LIST:
device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap")
Expand Down

0 comments on commit 02f3e78

Please sign in to comment.