(self, filepath, layer_id, linkname=None)
return True
Copy or rename an image layer file to a v1 repository
Copy or rename an image layer file to a v1 repository
Copy or rename an image layer file to a v1 repository
def _move_layer_to_v1repo(self, filepath, layer_id, linkname=None):
        """Copy or rename an image layer file to a v1 repository"""
        if filepath.endswith("json"):
            target_file = self.localrepo.layersdir + '/' + layer_id + ".json"
        elif filepath.endswith("layer.tar"):
            target_file = self.localrepo.layersdir + '/' + layer_id + ".layer"
        elif ':' in layer_id:
            (dummy, layer_id) = layer_id.split(':', 1)
            target_file = self.localrepo.layersdir + '/' + layer_id + ".layer"
        else:
            return False
        try:
            os.rename(filepath, target_file)
        except(IOError, OSError):
            if not FileUtil(filepath).copyto(target_file):
                return False
        self.localrepo.add_image_layer(target_file, linkname)
        return True
def _move_layer_to_v1repo ( self , filepath , layer_id , linkname = None ) : if filepath . endswith ( "json" ) : target_file = self . localrepo . layersdir + '/' + layer_id + ".json" elif filepath . endswith ( "layer.tar" ) : target_file = self . localrepo . layersdir + '/' + layer_id + ".layer" elif ':' in layer_id : ( dummy , layer_id ) = layer_id . split ( ':' , 1 ) target_file = self . localrepo . layersdir + '/' + layer_id + ".layer" else : return False try : os . rename ( filepath , target_file ) except ( IOError , OSError ) : if not FileUtil ( filepath ) . copyto ( target_file ) : return False self . localrepo . add_image_layer ( target_file , linkname ) return True