summaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/state_impl/_operations
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-08-25 12:43:29 +0200
committerWojtek Kosior <koszko@koszko.org>2022-09-28 12:54:53 +0200
commit503e546b2b0c9dba505a4e7940f257d41ad95f67 (patch)
treec17f245f8a826d4d385923557681ad372fb58b03 /src/hydrilla/proxy/state_impl/_operations
parent4dbbb2aec204a5cccc713e2e2098d6e0a47f8cf6 (diff)
downloadhaketilo-hydrilla-503e546b2b0c9dba505a4e7940f257d41ad95f67.tar.gz
haketilo-hydrilla-503e546b2b0c9dba505a4e7940f257d41ad95f67.zip
[proxy] properly flag failed package installations in sqlite db
Diffstat (limited to 'src/hydrilla/proxy/state_impl/_operations')
-rw-r--r--src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py b/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py
index 04a2910..f1e0414 100644
--- a/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py
+++ b/src/hydrilla/proxy/state_impl/_operations/pull_missing_files.py
@@ -81,17 +81,16 @@ def pull_missing_files(
try:
url = urljoin(repo_url, f'file/sha256/{sha256}')
response = requests.get(url)
- except:
- raise state.RepoCommunicationError()
- if not response.ok:
+ assert response.ok
+
+ file_bytes = response.content
+ except:
raise state.FileMissingError(
repo_id = str(repo_id),
sha256 = sha256
)
- file_bytes = response.content
-
computed_sha256 = hashlib.sha256(file_bytes).digest().hex()
if computed_sha256 != sha256:
raise state.FileIntegrityError(