(self, cmdp)
return self.STATUS_ERROR
import : import image (directory tree) from tar file or stdin
        import <tar-file> <repo/image:tag>
        import - <repo/image:tag>
        --mv                      :if possible move tar-file instead of copy
        --tocontainer             :import to container, no image is created
        --clone                   :import udocker container format with metadata
        --name=<container-name>   :with --tocontainer or --clone to add an alias
import : import image (directory tree) from tar file or stdin
        import <tar-file> <repo/image:tag>
        import - <repo/image:tag>
        --mv                      :if possible move tar-file instead of copy
        --tocontainer             :import to container, no image is created
        --clone                   :import udocker container format with metadata
        --name=<container-name>   :with --tocontainer or --clone to add an alias
import : import image ( directory tree ) from tar file or stdin import <tar - file > <repo / image : tag > import - <repo / image : tag > -- mv : if possible move tar - file instead of copy -- tocontainer : import to container no image is created -- clone : import udocker container format with metadata -- name = <container - name > : with -- tocontainer or -- clone to add an alias
def do_import(self, cmdp):
        """
        import : import image (directory tree) from tar file or stdin
        import <tar-file> <repo/image:tag>
        import - <repo/image:tag>
        --mv                      :if possible move tar-file instead of copy
        --tocontainer             :import to container, no image is created
        --clone                   :import udocker container format with metadata
        --name=<container-name>   :with --tocontainer or --clone to add an alias
        """
        move_tarball = cmdp.get("--mv")
        to_container = cmdp.get("--tocontainer")
        name = cmdp.get("--name=")
        clone = cmdp.get("--clone")
        from_stdin = cmdp.get('-')
        if from_stdin:
            tarfile = '-'
            imagespec = cmdp.get("P1")
            move_tarball = False
        else:
            tarfile = cmdp.get("P1")
            imagespec = cmdp.get("P2")
        if cmdp.missing_options():  # syntax error
            return self.STATUS_ERROR
        if not tarfile:
            Msg().err("Error: must specify tar filename")
            return self.STATUS_ERROR
        if to_container or clone:
            if clone:
                container_id = self.localfileapi.import_clone(
                    tarfile, name)
            else:
                (imagerepo, tag) = self._check_imagespec(imagespec,
                                                         "IMPORTED:unknown")
                container_id = self.localfileapi.import_tocontainer(
                    tarfile, imagerepo, tag, name)
            if container_id:
                Msg().out(container_id)
                return self.STATUS_OK
        else:
            (imagerepo, tag) = self._check_imagespec(imagespec)
            if not imagerepo:
                return self.STATUS_ERROR
            if self.localfileapi.import_toimage(tarfile, imagerepo, tag,
                                                move_tarball):
                return self.STATUS_OK
        Msg().err("Error: importing")
        return self.STATUS_ERROR
def do_import ( self , cmdp ) : move_tarball = cmdp . get ( "--mv" ) to_container = cmdp . get ( "--tocontainer" ) name = cmdp . get ( "--name=" ) clone = cmdp . get ( "--clone" ) from_stdin = cmdp . get ( '-' ) if from_stdin : tarfile = '-' imagespec = cmdp . get ( "P1" ) move_tarball = False else : tarfile = cmdp . get ( "P1" ) imagespec = cmdp . get ( "P2" ) if cmdp . missing_options ( ) : # syntax error return self . STATUS_ERROR if not tarfile : Msg ( ) . err ( "Error: must specify tar filename" ) return self . STATUS_ERROR if to_container or clone : if clone : container_id = self . localfileapi . import_clone ( tarfile , name ) else : ( imagerepo , tag ) = self . _check_imagespec ( imagespec , "IMPORTED:unknown" ) container_id = self . localfileapi . import_tocontainer ( tarfile , imagerepo , tag , name ) if container_id : Msg ( ) . out ( container_id ) return self . STATUS_OK else : ( imagerepo , tag ) = self . _check_imagespec ( imagespec ) if not imagerepo : return self . STATUS_ERROR if self . localfileapi . import_toimage ( tarfile , imagerepo , tag , move_tarball ) : return self . STATUS_OK Msg ( ) . err ( "Error: importing" ) return self . STATUS_ERROR