(self, host_path, cont_path)
return True
Create mountpoint
Create mountpoint
Create mountpoint
def create(self, host_path, cont_path):
        """Create mountpoint"""
        status = True
        mountpoint = self.container_root + '/' + cont_path
        if os.path.exists(mountpoint):
            if (stat.S_IFMT(os.stat(mountpoint).st_mode) ==
                    stat.S_IFMT(os.stat(host_path).st_mode)):
                return True
            Msg().err("Error: host and container volume paths not same type:",
                      host_path, cont_path)
            return False
        self.add(cont_path)
        if os.path.isfile(host_path):
            FileUtil(os.path.dirname(mountpoint)).mkdir()
            FileUtil(mountpoint).putdata("", "w")
            status = os.path.isfile(mountpoint) or os.path.islink(mountpoint)
        elif os.path.isdir(host_path):
            status = FileUtil(mountpoint).mkdir()
        if not status:
            Msg().err("Error: creating container mountpoint:", cont_path)
            self.delete(cont_path)
            return False
        return True
def create ( self , host_path , cont_path ) : status = True mountpoint = self . container_root + '/' + cont_path if os . path . exists ( mountpoint ) : if ( stat . S_IFMT ( os . stat ( mountpoint ) . st_mode ) == stat . S_IFMT ( os . stat ( host_path ) . st_mode ) ) : return True Msg ( ) . err ( "Error: host and container volume paths not same type:" , host_path , cont_path ) return False self . add ( cont_path ) if os . path . isfile ( host_path ) : FileUtil ( os . path . dirname ( mountpoint ) ) . mkdir ( ) FileUtil ( mountpoint ) . putdata ( "" , "w" ) status = os . path . isfile ( mountpoint ) or os . path . islink ( mountpoint ) elif os . path . isdir ( host_path ) : status = FileUtil ( mountpoint ) . mkdir ( ) if not status : Msg ( ) . err ( "Error: creating container mountpoint:" , cont_path ) self . delete ( cont_path ) return False return True