(self, tmp_imagedir)
return structure
Load OCI image structure
Load OCI image structure
Load OCI image structure
def _load_structure(self, tmp_imagedir):
        """Load OCI image structure"""
        structure = {}
        structure["repolayers"] = dict()
        structure["manifest"] = dict()
        f_path = tmp_imagedir + '/'
        structure["oci-layout"] = \
                self.localrepo.load_json(f_path + "oci-layout")
        structure["index"] = \
                self.localrepo.load_json(f_path + "index.json")
        if not (structure["index"] and structure["oci-layout"]):
            return {}
        for fname in os.listdir(tmp_imagedir + "/blobs"):
            f_path = tmp_imagedir + "/blobs/" + fname
            if FileUtil(f_path).isdir():
                layer_algorithm = fname
                for layer_f in os.listdir(f_path):
                    layer_id = layer_algorithm + ':' + layer_f
                    structure["repolayers"][layer_id] = dict()
                    structure["repolayers"][layer_id]["layer_f"] = \
                            f_path + '/' + layer_f
                    structure["repolayers"][layer_id]["layer_a"] = \
                            layer_algorithm
                    structure["repolayers"][layer_id]["layer_h"] = \
                            layer_f
        return structure
def _load_structure ( self , tmp_imagedir ) : structure = { } structure [ "repolayers" ] = dict ( ) structure [ "manifest" ] = dict ( ) f_path = tmp_imagedir + '/' structure [ "oci-layout" ] = self . localrepo . load_json ( f_path + "oci-layout" ) structure [ "index" ] = self . localrepo . load_json ( f_path + "index.json" ) if not ( structure [ "index" ] and structure [ "oci-layout" ] ) : return { } for fname in os . listdir ( tmp_imagedir + "/blobs" ) : f_path = tmp_imagedir + "/blobs/" + fname if FileUtil ( f_path ) . isdir ( ) : layer_algorithm = fname for layer_f in os . listdir ( f_path ) : layer_id = layer_algorithm + ':' + layer_f structure [ "repolayers" ] [ layer_id ] = dict ( ) structure [ "repolayers" ] [ layer_id ] [ "layer_f" ] = f_path + '/' + layer_f structure [ "repolayers" ] [ layer_id ] [ "layer_a" ] = layer_algorithm structure [ "repolayers" ] [ layer_id ] [ "layer_h" ] = layer_f return structure