@jsonrpc_method('os.kldload')
def os_kldload(request, plugin_id, module):
 plugin = Plugins.objects.filter(pk=plugin_id)
 if (plugin.exists() and (not Kmod.objects.filter(plugin__id=plugin[0].id, module=module).exists())):
  Kmod.objects.create(plugin=plugin[0], module=module, order=None)
 pipe = Popen(['/sbin/kldstat', '-n', module], stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
 pipe.communicate()
 if (pipe.returncode == 0):
  return True
 pipe = Popen(['/sbin/kldload', module], stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
 pipe.communicate()
 return (pipe.returncode == 0)

@ jsonrpc_method ( 'os.kldload' ) def os_kldload ( request , plugin_id , module ) : plugin = Plugins . objects . filter ( pk = plugin_id ) if ( plugin . exists ( ) and ( not Kmod . objects . filter ( plugin__id = plugin [ 0 ] . id , module = module ) . exists ( ) ) ) : Kmod . objects . create ( plugin = plugin [ 0 ] , module = module , order = None ) pipe = Popen ( [ '/sbin/kldstat' , '-n' , module ] , stdin = PIPE , stdout = PIPE , stderr = PIPE , close_fds = True ) pipe . communicate ( ) if ( pipe . returncode == 0 ) : return True pipe = Popen ( [ '/sbin/kldload' , module ] , stdin = PIPE , stdout = PIPE , stderr = PIPE , close_fds = True ) pipe . communicate ( ) return ( pipe . returncode == 0 )
load a kernel module returns: boolean .