mirror of
https://github.com/goharbor/harbor
synced 2025-04-18 16:15:49 +00:00
remove v1 flag in getManifestWithConf
This commit is contained in:
parent
5e258741d9
commit
233bbda16c
|
@ -20,7 +20,7 @@ class RegistryApi(object):
|
||||||
def __init__(self, username, password, registry_endpoint):
|
def __init__(self, username, password, registry_endpoint):
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
self.basic_token = base64.encodestring("%s:%s" % (str(username), str(password)))
|
self.basic_token = base64.encodestring("%s:%s" % (str(username), str(password)))[0:-1]
|
||||||
self.registry_endpoint = registry_endpoint.rstrip('/')
|
self.registry_endpoint = registry_endpoint.rstrip('/')
|
||||||
auth = self.pingRegistry("%s/v2/_catalog" % (self.registry_endpoint,))
|
auth = self.pingRegistry("%s/v2/_catalog" % (self.registry_endpoint,))
|
||||||
if auth is None:
|
if auth is None:
|
||||||
|
@ -142,9 +142,9 @@ class RegistryApi(object):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def getManifestWithConf(self, repository, reference="latest", v1=False):
|
def getManifestWithConf(self, repository, reference="latest"):
|
||||||
""" get manifest for tag or digest """
|
""" get manifest for tag or digest """
|
||||||
manifest = self.getManifest(repository, reference, v1)
|
manifest = self.getManifest(repository, reference)
|
||||||
if manifest is None:
|
if manifest is None:
|
||||||
raise RegistryException("manifest for %s %s not exist" % (repository, reference))
|
raise RegistryException("manifest for %s %s not exist" % (repository, reference))
|
||||||
config_digest = manifest["config"]["digest"]
|
config_digest = manifest["config"]["digest"]
|
||||||
|
@ -157,8 +157,6 @@ class RegistryApi(object):
|
||||||
req.get_method = lambda: 'GET'
|
req.get_method = lambda: 'GET'
|
||||||
req.add_header('Authorization', r'Bearer %s' % (bear_token,))
|
req.add_header('Authorization', r'Bearer %s' % (bear_token,))
|
||||||
req.add_header('Accept', 'application/vnd.docker.distribution.manifest.v2+json')
|
req.add_header('Accept', 'application/vnd.docker.distribution.manifest.v2+json')
|
||||||
if v1:
|
|
||||||
req.add_header('Accept', 'application/vnd.docker.distribution.manifest.v1+json')
|
|
||||||
try:
|
try:
|
||||||
response = urllib2.urlopen(req)
|
response = urllib2.urlopen(req)
|
||||||
manifest["configContent"] = json.loads(response.read())
|
manifest["configContent"] = json.loads(response.read())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user