(self, imagetagdir)
return structure
Scan the repository structure of a given image tag
Scan the repository structure of a given image tag
Scan the repository structure of a given image tag
def _load_structure(self, imagetagdir):
        """Scan the repository structure of a given image tag"""
        structure = {}
        structure["repolayers"] = dict()
        if FileUtil(imagetagdir).isdir():
            for fname in os.listdir(imagetagdir):
                f_path = imagetagdir + '/' + fname
                if fname == "ancestry":
                    structure["ancestry"] = self.load_json(f_path)

                if fname == "manifest":
                    structure["manifest"] = self.load_json(f_path)

                if len(fname) >= 64:
                    layer_id = fname.replace(".json", "").replace(".layer", "")
                    if layer_id not in structure["repolayers"]:
                        structure["repolayers"][layer_id] = dict()
                    if fname.endswith("json"):
                        structure["repolayers"][layer_id]["json"] = \
                            self.load_json(f_path)
                        structure["repolayers"][layer_id]["json_f"] = f_path
                        structure["has_json_f"] = True
                    elif fname.endswith("layer"):
                        structure["repolayers"][layer_id]["layer_f"] = f_path
                    elif ':' in fname:
                        structure["repolayers"][layer_id]["layer_f"] = f_path
                    else:
                        Msg().out("Warning: unkwnon file in layer:", f_path,
                                  l=Msg.WAR)
                elif fname in ("TAG", "v1", "v2", "PROTECT", "container.json"):
                    pass

                Msg().out("Warning: unkwnon file in image:", f_path, l=Msg.WAR)

        return structure
def _load_structure ( self , imagetagdir ) : structure = { } structure [ "repolayers" ] = dict ( ) if FileUtil ( imagetagdir ) . isdir ( ) : for fname in os . listdir ( imagetagdir ) : f_path = imagetagdir + '/' + fname if fname == "ancestry" : structure [ "ancestry" ] = self . load_json ( f_path ) if fname == "manifest" : structure [ "manifest" ] = self . load_json ( f_path ) if len ( fname ) >= 64 : layer_id = fname . replace ( ".json" , "" ) . replace ( ".layer" , "" ) if layer_id not in structure [ "repolayers" ] : structure [ "repolayers" ] [ layer_id ] = dict ( ) if fname . endswith ( "json" ) : structure [ "repolayers" ] [ layer_id ] [ "json" ] = self . load_json ( f_path ) structure [ "repolayers" ] [ layer_id ] [ "json_f" ] = f_path structure [ "has_json_f" ] = True elif fname . endswith ( "layer" ) : structure [ "repolayers" ] [ layer_id ] [ "layer_f" ] = f_path elif ':' in fname : structure [ "repolayers" ] [ layer_id ] [ "layer_f" ] = f_path else : Msg ( ) . out ( "Warning: unkwnon file in layer:" , f_path , l = Msg . WAR ) elif fname in ( "TAG" , "v1" , "v2" , "PROTECT" , "container.json" ) : pass Msg ( ) . out ( "Warning: unkwnon file in image:" , f_path , l = Msg . WAR ) return structure