Skip to content

Commit

Permalink
fix: skip broken symlinks on hash computing
Browse files Browse the repository at this point in the history
  • Loading branch information
ahlinc committed Nov 17, 2024
1 parent 00a7172 commit cb2a020
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,16 @@ def update_hash(hash_obj, file_root, file_path):
relative_path = os.path.join(file_root, file_path)
hash_obj.update(relative_path.encode())

with open(relative_path, "rb") as open_file:
while True:
data = open_file.read(1024 * 8)
if not data:
break
hash_obj.update(data)
try:
with open(relative_path, "rb") as open_file:
while True:
data = open_file.read(1024 * 8)
if not data:
break
hash_obj.update(data)
# ignore broken symlinks content to don't fail on `terraform destroy` command
except FileNotFoundError:
pass


class ZipWriteStream:
Expand Down

0 comments on commit cb2a020

Please sign in to comment.