Skip to content
Snippets Groups Projects
Commit 435dc372 authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

archiver.director: make the standard input reader more resilient to errors

parent b7f8e66c
No related branches found
No related tags found
No related merge requests found
......@@ -154,8 +154,14 @@ def read_sha1_from_stdin():
"""Read sha1 from stdin.
"""
for sha1 in sys.stdin:
yield {'content_id': hashutil.hex_to_hash(sha1.rstrip())}
for line in sys.stdin:
sha1 = line.strip()
try:
yield {'content_id': hashutil.hex_to_hash(sha1)}
except Exception:
print("%s is not a valid sha1 hash, continuing" % repr(sha1),
file=sys.stderr)
continue
class ArchiverStdinToBackendDirector(ArchiverDirectorBase):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment