(self)
return dest_container_id
Clone a container by creating a complete copy
Clone a container by creating a complete copy
Clone a container by creating a complete copy
def clone(self):
        """Clone a container by creating a complete copy
        """
        source_container_dir = self.localrepo.cd_container(self.container_id)
        if not source_container_dir:
            Msg().err("Error: source container not found:", self.container_id)
            return False

        dest_container_id = Unique().uuid(os.path.basename(self.imagerepo))
        dest_container_dir = self.localrepo.setup_container(
            "CLONING", "inprogress", dest_container_id)
        if not dest_container_dir:
            Msg().err("Error: create destination container: setting up")
            return False

        status = FileUtil(source_container_dir).copydir(dest_container_dir)
        if not status:
            Msg().err("Error: creating container:", dest_container_id)
            return False

        if not self._chk_container_root(dest_container_id):
            Msg().out("Warning: check container content:", dest_container_id,
                      l=Msg.WAR)

        return dest_container_id
def clone ( self ) : source_container_dir = self . localrepo . cd_container ( self . container_id ) if not source_container_dir : Msg ( ) . err ( "Error: source container not found:" , self . container_id ) return False dest_container_id = Unique ( ) . uuid ( os . path . basename ( self . imagerepo ) ) dest_container_dir = self . localrepo . setup_container ( "CLONING" , "inprogress" , dest_container_id ) if not dest_container_dir : Msg ( ) . err ( "Error: create destination container: setting up" ) return False status = FileUtil ( source_container_dir ) . copydir ( dest_container_dir ) if not status : Msg ( ) . err ( "Error: creating container:" , dest_container_id ) return False if not self . _chk_container_root ( dest_container_id ) : Msg ( ) . out ( "Warning: check container content:" , dest_container_id , l = Msg . WAR ) return dest_container_id