add explanation of some errors
This commit is contained in:
12
registry.py
12
registry.py
@@ -134,6 +134,14 @@ def decode_base64(data):
|
|||||||
return base64.decodestring(data)
|
return base64.decodestring(data)
|
||||||
|
|
||||||
|
|
||||||
|
def print_error_explanation(context, error_code):
|
||||||
|
error_list = {"delete_tag_405": 'You might want to set REGISTRY_STORAGE_DELETE_ENABLED: "true" in your registry',
|
||||||
|
"get_tag_digest_404": "Try adding flag --digest-method=GET"}
|
||||||
|
|
||||||
|
key = "%s_%s" % (context, error_code)
|
||||||
|
if key in error_list.keys():
|
||||||
|
print(error_list[key])
|
||||||
|
|
||||||
def get_auth_schemes(r,path):
|
def get_auth_schemes(r,path):
|
||||||
""" Returns list of auth schemes(lowcased) if www-authenticate: header exists
|
""" Returns list of auth schemes(lowcased) if www-authenticate: header exists
|
||||||
returns None if no header found
|
returns None if no header found
|
||||||
@@ -267,7 +275,8 @@ class Registry:
|
|||||||
image_name, tag), method=self.digest_method)
|
image_name, tag), method=self.digest_method)
|
||||||
|
|
||||||
if image_headers is None:
|
if image_headers is None:
|
||||||
print(" tag digest not found: {0}. Try --digest-method=GET".format(self.last_error))
|
print(" tag digest not found: {0}.".format(self.last_error))
|
||||||
|
print_error_explanation("get_tag_digest", self.last_error)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
tag_digest = image_headers.headers['Docker-Content-Digest']
|
tag_digest = image_headers.headers['Docker-Content-Digest']
|
||||||
@@ -294,6 +303,7 @@ class Registry:
|
|||||||
|
|
||||||
if delete_result is None:
|
if delete_result is None:
|
||||||
print("failed, error: {0}".format(self.last_error))
|
print("failed, error: {0}".format(self.last_error))
|
||||||
|
print_error_explanation("delete_tag", self.last_error)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
tag_digests_to_ignore.append(tag_digest)
|
tag_digests_to_ignore.append(tag_digest)
|
||||||
|
|||||||
Reference in New Issue
Block a user