Loading behave_utils/docker.py +17 −2 Original line number Diff line number Diff line Loading @@ -174,6 +174,8 @@ class Image(Item): Docker image items """ _cache = dict[str, str]() T = TypeVar('T', bound='Image') def __init__(self, iid: str): Loading @@ -200,10 +202,23 @@ class Image(Item): """ Pull an image from a registry """ try: iid = cls._cache[repository] except KeyError: docker(b"pull", repository) iid = Item(repository).inspect().path('$.Id', str) iid = cls._process_image(repository) return cls(iid) @classmethod def _process_image(cls, reference: str) -> str: report = Item(reference).inspect() iid = report.path("$.Id", str) cls._cache.update( ((tag, iid) for tag in report.path("$.RepoTags", list[str])), reference=iid, ) return iid def get_id(self) -> str: """ Return an identifier for the Docker Image Loading Loading
behave_utils/docker.py +17 −2 Original line number Diff line number Diff line Loading @@ -174,6 +174,8 @@ class Image(Item): Docker image items """ _cache = dict[str, str]() T = TypeVar('T', bound='Image') def __init__(self, iid: str): Loading @@ -200,10 +202,23 @@ class Image(Item): """ Pull an image from a registry """ try: iid = cls._cache[repository] except KeyError: docker(b"pull", repository) iid = Item(repository).inspect().path('$.Id', str) iid = cls._process_image(repository) return cls(iid) @classmethod def _process_image(cls, reference: str) -> str: report = Item(reference).inspect() iid = report.path("$.Id", str) cls._cache.update( ((tag, iid) for tag in report.path("$.RepoTags", list[str])), reference=iid, ) return iid def get_id(self) -> str: """ Return an identifier for the Docker Image Loading