Exemple #1
0
 def _make_image(self, image, info, remote=False):
     img_obj = Image(image, backend=self, remote=remote)
     if remote:
         return img_obj
     name = info['Id']
     img_obj.input_name = image
     img_obj.name = image
     img_obj.config = info
     img_obj.backend = self
     img_obj.id = name
     img_obj.registry, img_obj.repo, img_obj.image, img_obj.tag, _ = Decompose(
         image).all
     img_obj.repotags = info['RepoTags']
     img_obj.created = info['Created']
     img_obj.size = None
     img_obj.original_structure = info
     img_obj.deep = True
     img_obj.labels = info.get('Labels', None)
     img_obj.version = img_obj.get_label("Version")
     img_obj.release = img_obj.get_label("Release")
     ostree_manifest = self.syscontainers.get_manifest(image)
     if ostree_manifest:
         ostree_manifest = json_loads(ostree_manifest)
     img_obj.digest = None if ostree_manifest is None else ostree_manifest.get(
         'Digest') or ostree_manifest.get('digest')
     img_obj.os = img_obj.get_label("Os")
     img_obj.arch = img_obj.get_label("Arch")
     img_obj.graph_driver = None
     return img_obj
Exemple #2
0
 def _make_image(self, image, info, remote=False):
     img_obj = Image(image, backend=self, remote=remote)
     if remote:
         return img_obj
     name = info['Id']
     img_obj.input_name = image
     img_obj.name = image
     img_obj.config = info
     img_obj.backend = self
     img_obj.id = name
     img_obj.registry, img_obj.repo, img_obj.image, img_obj.tag, _ = Decompose(image).all
     img_obj.repotags = info['RepoTags']
     img_obj.created = info['Created']
     img_obj.size = info.get('VirtualSize', None)
     img_obj.virtual_size = info.get('VirtualSize', None)
     img_obj.original_structure = info
     img_obj.deep = True
     img_obj.labels = info.get('Labels', None)
     img_obj.version = img_obj.get_label("Version")
     img_obj.release = img_obj.get_label("Release")
     ostree_manifest = self.syscontainers.get_manifest(image)
     if ostree_manifest:
         ostree_manifest = json_loads(ostree_manifest)
     img_obj.digest = None if ostree_manifest is None else ostree_manifest.get('Digest') or ostree_manifest.get('digest')
     img_obj.os = img_obj.get_label("Os")
     img_obj.arch = img_obj.get_label("Arch")
     img_obj.graph_driver = None
     return img_obj
Exemple #3
0
 def _make_image(self, image, info):
     name = info['Id']
     img_obj = Image(image, backend=self, remote=False)
     img_obj.input_name = image
     img_obj.name = image
     img_obj.config = info
     img_obj.backend = self
     img_obj.id = name
     img_obj.registry = None
     img_obj.repo = None
     img_obj.image = name
     img_obj.tag = name
     img_obj.repotags = info['RepoTags']
     img_obj.created = info['Created']
     img_obj.size = None
     img_obj.original_structure = info
     img_obj.deep = True
     img_obj.labels = info['Labels']
     img_obj.version = img_obj.get_label("Version")
     img_obj.release = img_obj.get_label("Release")
     img_obj.digest = None
     img_obj.os = img_obj.get_label("Os")
     img_obj.arch = img_obj.get_label("Arch")
     img_obj.graph_driver = None
     return img_obj
Exemple #4
0
 def _make_image(self, image, info):
     name = info['Id']
     image = Image(image, backend=self, remote=False)
     image.name = name
     image.config = info
     image.backend = self
     image.id = name
     image.registry = None
     image.repo = None
     image.image = name
     image.tag = name
     image.repotags = info['RepoTags']
     image.created = info['Created']
     image.size = None
     image.original_structure = info
     image.input_name = info['Id']
     image.deep = True
     image.labels = info['Labels']
     image.version = image.get_label("Version")
     image.release = image.get_label("Release")
     image.digest = None
     image.os = image.get_label("Os")
     image.arch = image.get_label("Arch")
     image.graph_driver = None
     return image
Exemple #5
0
    def _make_image(self, image, img_struct, deep=False, remote=False):
        img_obj = Image(image, remote=remote)
        img_obj.backend = self
        if not remote and not deep:
            img_obj.size = img_struct['size']
            img_obj.virtual_size = img_obj.size
            img_obj.version = img_obj.version
            img_obj.repotags = img_struct['names']

        if not remote:
            try:
                img_obj.id = img_struct['id']
            except KeyError:
                img_obj.id = img_struct['ID']
            try:
                img_obj.created = DT.datetime.strptime(
                    img_struct['created'],
                    "%b %d, %Y %H:%M").strftime("%Y-%m-%d %H:%M")
            except KeyError:
                img_obj.created = time.mktime(
                    time.strptime(img_struct['Created'].split(".")[0],
                                  "%Y-%m-%dT%H:%M:%S"))
            try:
                img_obj.size = img_struct['size']
            except KeyError:
                img_obj.size = img_struct['Size']
            try:
                img_obj.digest = img_struct['digest']
            except KeyError:
                img_obj.digest = img_struct['Digest']

        if deep:
            img_obj.deep = True
            img_obj.repotags = img_struct['Tags']
            img_obj.config = img_struct['Config'] or {}
            img_obj.labels = img_obj.config.get("Labels", None)
            img_obj.os = img_struct['OS']
            img_obj.arch = img_struct['Architecture']
            img_obj.graph_driver = img_struct['GraphDriver']
            img_obj.version = img_obj.get_label('Version')
            img_obj.release = img_obj.get_label('Release')
            # kpod inspect has no Parent right now
            #img_obj.parent = img_struct['Parent']
            img_obj.original_structure = img_struct
            img_obj.cmd = img_obj.original_structure['Config']['Cmd']

        return img_obj
Exemple #6
0
    def _make_image(self, image, img_struct, deep=False, remote=False):
        img_obj = Image(image, remote=remote)
        img_obj.backend = self
        if not remote and not deep:
            img_obj.size = img_struct['size']
            img_obj.virtual_size = img_obj.size
            img_obj.version = img_obj.version
            img_obj.repotags = img_struct['names']

        if not remote:
            try:
                img_obj.id = img_struct['id']
            except KeyError:
                img_obj.id = img_struct['ID']
            try:
                img_obj.created = DT.datetime.strptime(img_struct['created'], "%b %d, %Y %H:%M").strftime("%Y-%m-%d %H:%M")
            except KeyError:
                img_obj.created = time.mktime(time.strptime(img_struct['Created'].split(".")[0], "%Y-%m-%dT%H:%M:%S"))
            try:
                img_obj.size = img_struct['size']
            except KeyError:
                img_obj.size = img_struct['Size']
            try:
                img_obj.digest = img_struct['digest']
            except KeyError:
                img_obj.digest = img_struct['Digest']

        if deep:
            img_obj.deep = True
            img_obj.repotags = img_struct['Tags']
            img_obj.config = img_struct['Config'] or {}
            img_obj.labels = img_obj.config.get("Labels", None)
            img_obj.os = img_struct['OS']
            img_obj.arch = img_struct['Architecture']
            img_obj.graph_driver = img_struct['GraphDriver']
            img_obj.version = img_obj.get_label('Version')
            img_obj.release = img_obj.get_label('Release')
            # kpod inspect has no Parent right now
            #img_obj.parent = img_struct['Parent']
            img_obj.original_structure = img_struct
            img_obj.cmd = img_obj.original_structure['Config']['Cmd']

        return img_obj