crashvb / docker-registry-client-async

An AIOHTTP based Python REST client for the Docker Registry.
Apache License 2.0
5 stars 6 forks source link

Handle omitted tag #10

Closed AstraLuma closed 4 years ago

AstraLuma commented 4 years ago

eg ImageName.parse('python')

crashvb commented 4 years ago

Parsing image names w/o out tags should be handled correctly:

https://github.com/crashvb/docker-registry-client-async/blob/f24983559099b8779a5f4fb526b7eb7fef58e427/docker_registry_client_async/imagename.py#L87

>>> from docker_registry_client_async import ImageName
>>> image_name = ImageName.parse('python')
>>> image_name
<docker_registry_client_async.imagename.ImageName object at 0x7ff40042b640>
>>> image_name.tag
>>> image_name.resolve_tag()
'latest'
>>>

ImageName.resolv_tag() should retrieve the tag || env(DRCA_DEFAULT_TAG) || "latest" ImageName.tag should retrieve the raw parsed / initialized tag

AstraLuma commented 4 years ago

Ok, but when I tried to do operations using such a name, it produces bad URLs.

    async with DockerRegistryClientAsync() as drca:
        name = ImageName.parse("python")
        result = await drca.get_manifest(name)
aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://index.docker.io/v2/library/python/manifests/')
crashvb commented 4 years ago

Yep, that's a gap.