Skip to content

Commit ba88de9

Browse files
committed
Update oras
Signed-off-by: Prabhu Subramanian <[email protected]>
1 parent 91e72e7 commit ba88de9

File tree

3 files changed

+8
-37
lines changed

3 files changed

+8
-37
lines changed

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ dev = [
5252
"pytest",
5353
"pytest-cov",
5454
]
55-
oras = ["oras==0.1.30"]
56-
all = ["oras==0.1.30"]
55+
oras = ["oras>=0.2.25"]
56+
all = ["oras>=0.2.25"]
5757

5858
[tool.setuptools]
5959
packages = ["vdb", "vdb.lib", "vdb.lib.cve_model"]

uv.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vdb/lib/orasclient.py

+1-30
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,16 @@
22
import tarfile
33

44
import oras.client
5-
import oras.provider
65
from oras.logger import setup_logger
76

8-
97
setup_logger(quiet=True, debug=False)
108

119

12-
class VdbDistributionRegistry(oras.provider.Registry):
13-
"""
14-
We override the default registry to make things compatible with ghcr. Without this, the below error is thrown.
15-
16-
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('artifactType' was unexpected)
17-
"""
18-
19-
def get_manifest(self, container, allowed_media_type=None, refresh_headers=True):
20-
"""
21-
Retrieve a manifest for a package.
22-
23-
:param container: parsed container URI
24-
:type container: oras.container.Container or str
25-
:param allowed_media_type: one or more allowed media types
26-
:type allowed_media_type: str
27-
"""
28-
if not allowed_media_type:
29-
allowed_media_type = [oras.defaults.default_manifest_media_type]
30-
headers = {"Accept": ";".join(allowed_media_type)}
31-
32-
get_manifest = f"{self.prefix}://{container.manifest_url()}" # type: ignore
33-
response = self.do_request(get_manifest, "GET", headers=headers)
34-
self._check_200_response(response)
35-
manifest = response.json()
36-
return manifest
37-
38-
3910
def download_image(target, outdir):
4011
"""
4112
Method to download vdb files from a oci registry
4213
"""
43-
oras_client = oras.client.OrasClient(registry=VdbDistributionRegistry())
14+
oras_client = oras.client.OrasClient()
4415
paths_list = oras_client.pull(
4516
target=target,
4617
outdir=outdir,

0 commit comments

Comments
 (0)