Merge pull request #3336 from quay/small-cleanup
Some small cleanup to the tag backfill worker
This commit is contained in:
commit
171e2ec39b
3 changed files with 4 additions and 7 deletions
|
@ -194,10 +194,6 @@ class DockerSchema1Manifest(ManifestInterface):
|
|||
if validate:
|
||||
self._validate()
|
||||
|
||||
@classmethod
|
||||
def for_latin1_bytes(cls, encoded_bytes, validate=True):
|
||||
return DockerSchema1Manifest(Bytes.for_string_or_unicode(encoded_bytes), validate)
|
||||
|
||||
def _validate(self):
|
||||
if not self._signatures:
|
||||
return
|
||||
|
|
|
@ -131,7 +131,7 @@ def test_validate_manifest_with_unicode_encoded():
|
|||
with open(os.path.join(test_dir, 'manifest_unicode_row.json'), 'r') as f:
|
||||
manifest_bytes = json.loads(f.read())[0]['json_data']
|
||||
|
||||
manifest = DockerSchema1Manifest.for_latin1_bytes(manifest_bytes, validate=True)
|
||||
manifest = DockerSchema1Manifest(Bytes.for_string_or_unicode(manifest_bytes), validate=True)
|
||||
digest = manifest.digest
|
||||
assert digest == 'sha256:dde3714ce7e23edc6413aa85c0b42792e4f2f79e9ea36afc154d63ff3d04e86c'
|
||||
assert manifest.created_datetime
|
||||
|
|
|
@ -175,7 +175,7 @@ def backfill_tag(repositorytag):
|
|||
if lookup_map_row(repositorytag):
|
||||
return False
|
||||
|
||||
# Grab the manifest for the RepositoryTag, backfilling is necessary.
|
||||
# Grab the manifest for the RepositoryTag, backfilling as necessary.
|
||||
manifest_id = _get_manifest_id(repositorytag)
|
||||
if manifest_id is None:
|
||||
return False
|
||||
|
@ -269,7 +269,8 @@ def _backfill_manifest(tag_manifest):
|
|||
# without additional rows or data, as it will eventually not be useful.
|
||||
is_broken = False
|
||||
try:
|
||||
manifest = DockerSchema1Manifest.for_latin1_bytes(tag_manifest.json_data, validate=False)
|
||||
manifest = DockerSchema1Manifest(Bytes.for_string_or_unicode(tag_manifest.json_data),
|
||||
validate=False)
|
||||
except ManifestException:
|
||||
logger.exception('Exception when trying to parse manifest %s', tag_manifest.id)
|
||||
manifest = BrokenManifest(tag_manifest.digest, tag_manifest.json_data)
|
||||
|
|
Reference in a new issue