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
def _make_image(self, image, img_struct, deep=False, remote=False): img_obj = Image(image, remote=remote) img_obj.backend = self if not remote: img_obj.id = img_struct['Id'] img_obj.repotags = img_struct['RepoTags'] img_obj.created = img_struct['Created'] img_obj.size = img_struct['Size'] img_obj.virtual_size = img_struct['VirtualSize'] img_obj.original_structure = img_struct if deep: img_obj.deep = True img_obj.repotags = img_struct['RepoTags'] 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') img_obj.parent = img_struct['Parent'] img_obj.original_structure = img_struct img_obj.cmd = img_obj.original_structure['Config']['Cmd'] return img_obj
def _make_image(self, image, img_struct, deep=False, remote=False): img_obj = Image(image, remote=remote) img_obj.backend = self if not remote: img_obj.id = img_struct["Id"] img_obj.repotags = img_struct["RepoTags"] img_obj.created = img_struct["Created"] img_obj.size = img_struct["Size"] img_obj.virtual_size = img_struct["VirtualSize"] img_obj.original_structure = img_struct if deep: img_obj.deep = True img_obj.repotags = img_struct["RepoTags"] 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") img_obj.parent = img_struct["Parent"] img_obj.original_structure = img_struct img_obj.cmd = img_obj.original_structure["Config"]["Cmd"] return img_obj
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
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
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