Skip to content

Commit

Permalink
Fix: Cannot locally test azul-docker-pycharm changes (#5986, PR #6032)
Browse files Browse the repository at this point in the history
  • Loading branch information
achave11-ucsc committed Mar 26, 2024
2 parents d86aa6d + 8b61b57 commit be78a54
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/azul/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ def parse(cls, image_ref: str) -> Self:
TagImageRef(registry='4', username='3', repository=('2',), tag='1')
>>> ImageRef.parse('5/4/3/2:1')
TagImageRef(registry='5', username='4', repository=('3', '2'), tag='1')
>>> ImageRef.parse('localhost:5000/docker.io/ucscgi/azul-pycharm:2023.3.4-15')
... # doctest: +NORMALIZE_WHITESPACE
TagImageRef(registry='localhost:5000',
username='docker.io',
repository=('ucscgi', 'azul-pycharm'),
tag='2023.3.4-15')
"""
if '@' in image_ref:
return DigestImageRef.parse(image_ref)
Expand Down Expand Up @@ -215,7 +221,8 @@ class TagImageRef(ImageRef):

@classmethod
def parse(cls, image_ref: str) -> Self:
name, tag = image_ref.split(':')
# A colon in the first part of the name might separate host and port
name, _, tag = image_ref.rpartition(':')
return cls.create(name, tag)

@classmethod
Expand Down Expand Up @@ -437,7 +444,10 @@ def get_blob(self, digest: str) -> bytes:

@cached_property
def _client(self):
return DXF(host=self.host, repo=self.name, auth=self._auth)
return DXF(host=self.host,
repo=self.name,
auth=self._auth,
insecure=self.host.startswith('localhost:') or self.host == 'localhost')

def _auth(self, dxf: DXFBase, response: requests.Response):
host: str = furl(response.request.url).host
Expand Down

0 comments on commit be78a54

Please sign in to comment.