Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
f51aaa47
Commit
f51aaa47
authored
Oct 17, 2024
by
Paul Graydon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos/cli: Nicer error messages for cachelookup binary-sr
parent
cc4a6ab3
Pipeline
#37586
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
slapos/cli/cache_binarysr.py
slapos/cli/cache_binarysr.py
+9
-0
slapos/tests/test_cli.py
slapos/tests/test_cli.py
+2
-2
No files found.
slapos/cli/cache_binarysr.py
View file @
f51aaa47
...
@@ -34,6 +34,8 @@ import sys
...
@@ -34,6 +34,8 @@ import sys
import
prettytable
import
prettytable
from
six.moves.urllib.error
import
HTTPError
from
slapos.grid
import
networkcache
from
slapos.grid
import
networkcache
from
slapos.cli.config
import
ConfigCommand
from
slapos.cli.config
import
ConfigCommand
from
slapos.util
import
str2bytes
from
slapos.util
import
str2bytes
...
@@ -88,6 +90,13 @@ def do_lookup(logger, cache_dir, cache_url, signature_certificate_list,
...
@@ -88,6 +90,13 @@ def do_lookup(logger, cache_dir, cache_url, signature_certificate_list,
try
:
try
:
entries
=
networkcache
.
download_entry_list
(
cache_url
,
cache_dir
,
entries
=
networkcache
.
download_entry_list
(
cache_url
,
cache_dir
,
md5
,
logger
,
signature_certificate_list
)
md5
,
logger
,
signature_certificate_list
)
except
HTTPError
as
e
:
if
e
.
code
==
404
:
logger
.
info
(
'Software release not found in binary cache: %s'
,
software_url
)
else
:
logger
.
critical
(
'Problem occurred while connecting to shacache.'
,
exc_info
=
True
)
return
1
except
Exception
:
except
Exception
:
logger
.
critical
(
'Error while looking object %s'
,
software_url
,
logger
.
critical
(
'Error while looking object %s'
,
software_url
,
exc_info
=
True
)
exc_info
=
True
)
...
...
slapos/tests/test_cli.py
View file @
f51aaa47
...
@@ -141,8 +141,8 @@ class TestCliCacheBinarySr(CliMixin):
...
@@ -141,8 +141,8 @@ class TestCliCacheBinarySr(CliMixin):
software_url
=
"this_is_uncached_url"
,
software_url
=
"this_is_uncached_url"
,
signature_certificate_list
=
self
.
sign_cert_list
))
signature_certificate_list
=
self
.
sign_cert_list
))
self
.
logger
.
critical
.
assert_any_call
(
self
.
logger
.
info
.
assert_any_call
(
'
Error while looking object %s'
,
'this_is_uncached_url'
,
exc_info
=
True
)
'
Software release not found in binary cache: this_is_uncached_url'
)
def
test_bad_cache_dir
(
self
):
def
test_bad_cache_dir
(
self
):
self
.
assertEqual
(
1
,
cache_binarysr_do_lookup
(
self
.
assertEqual
(
1
,
cache_binarysr_do_lookup
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment