(self, tmp_imagedir)
return structure
Load the structure of a Docker image
Load the structure of a Docker image
Load the structure of a Docker image
def _load_structure(self, tmp_imagedir):
        """Load the structure of a Docker image"""
        structure = {}
        structure["repolayers"] = dict()
        structure["repoconfigs"] = dict()
        for fname in os.listdir(tmp_imagedir):
            f_path = tmp_imagedir + '/' + fname
            if fname == "repositories":
                structure["repositories"] = \
                        self.localrepo.load_json(f_path)
            elif fname == "manifest.json":
                structure["manifest"] = \
                        self.localrepo.load_json(f_path)
            elif len(fname) >= 69 and fname.endswith(".json"):
                structure["repoconfigs"][fname] = dict()
                structure["repoconfigs"][fname]["json"] = \
                        self.localrepo.load_json(f_path)
                structure["repoconfigs"][fname]["json_f"] = \
                        f_path
            elif len(fname) >= 64 and FileUtil(f_path).isdir():
                layer_id = fname
                structure["repolayers"][layer_id] = dict()
                for layer_f in os.listdir(f_path):
                    layer_f_path = f_path + '/' + layer_f
                    if layer_f == "VERSION":
                        structure["repolayers"][layer_id]["VERSION"] = \
                                self.localrepo.load_json(layer_f_path)
                    elif layer_f == "json":
                        structure["repolayers"][layer_id]["json"] = \
                                self.localrepo.load_json(layer_f_path)
                        structure["repolayers"][layer_id]["json_f"] = \
                                layer_f_path
                    elif "layer" in layer_f:
                        structure["repolayers"][layer_id]["layer_f"] = \
                                layer_f_path
                    else:
                        Msg().out("Info: warning: unkwnon file in layer:",
                                  f_path, l=Msg.WAR)
        return structure
def _load_structure ( self , tmp_imagedir ) : structure = { } structure [ "repolayers" ] = dict ( ) structure [ "repoconfigs" ] = dict ( ) for fname in os . listdir ( tmp_imagedir ) : f_path = tmp_imagedir + '/' + fname if fname == "repositories" : structure [ "repositories" ] = self . localrepo . load_json ( f_path ) elif fname == "manifest.json" : structure [ "manifest" ] = self . localrepo . load_json ( f_path ) elif len ( fname ) >= 69 and fname . endswith ( ".json" ) : structure [ "repoconfigs" ] [ fname ] = dict ( ) structure [ "repoconfigs" ] [ fname ] [ "json" ] = self . localrepo . load_json ( f_path ) structure [ "repoconfigs" ] [ fname ] [ "json_f" ] = f_path elif len ( fname ) >= 64 and FileUtil ( f_path ) . isdir ( ) : layer_id = fname structure [ "repolayers" ] [ layer_id ] = dict ( ) for layer_f in os . listdir ( f_path ) : layer_f_path = f_path + '/' + layer_f if layer_f == "VERSION" : structure [ "repolayers" ] [ layer_id ] [ "VERSION" ] = self . localrepo . load_json ( layer_f_path ) elif layer_f == "json" : structure [ "repolayers" ] [ layer_id ] [ "json" ] = self . localrepo . load_json ( layer_f_path ) structure [ "repolayers" ] [ layer_id ] [ "json_f" ] = layer_f_path elif "layer" in layer_f : structure [ "repolayers" ] [ layer_id ] [ "layer_f" ] = layer_f_path else : Msg ( ) . out ( "Info: warning: unkwnon file in layer:" , f_path , l = Msg . WAR ) return structure