Skip to content

Commit cb2a020

Browse files
committed
fix: skip broken symlinks on hash computing
1 parent 00a7172 commit cb2a020

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

package.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,16 @@ def update_hash(hash_obj, file_root, file_path):
272272
relative_path = os.path.join(file_root, file_path)
273273
hash_obj.update(relative_path.encode())
274274

275-
with open(relative_path, "rb") as open_file:
276-
while True:
277-
data = open_file.read(1024 * 8)
278-
if not data:
279-
break
280-
hash_obj.update(data)
275+
try:
276+
with open(relative_path, "rb") as open_file:
277+
while True:
278+
data = open_file.read(1024 * 8)
279+
if not data:
280+
break
281+
hash_obj.update(data)
282+
# ignore broken symlinks content to don't fail on `terraform destroy` command
283+
except FileNotFoundError:
284+
pass
281285

282286

283287
class ZipWriteStream:

0 commit comments

Comments
 (0)