def mod_list(only_persist=False):
 mods = set()
 if only_persist:
  conf = _get_modules_conf()
  if os.path.exists(conf):
   try:
    with salt.utils.fopen(conf, 'r') as modules_file:
     for line in modules_file:
      line = line.strip()
      mod_name = _strip_module_name(line)
      if ((not line.startswith('#')) and mod_name):
       mods.add(mod_name)
   except IOError:
    log.error('kmod module could not open modules file at {0}'.format(conf))
 else:
  for mod in lsmod():
   mods.add(mod['module'])
 return sorted(list(mods))

def mod_list ( only_persist = False ) : mods = set ( ) if only_persist : conf = _get_modules_conf ( ) if os . path . exists ( conf ) : try : with salt . utils . fopen ( conf , 'r' ) as modules_file : for line in modules_file : line = line . strip ( ) mod_name = _strip_module_name ( line ) if ( ( not line . startswith ( '#' ) ) and mod_name ) : mods . add ( mod_name ) except IOError : log . error ( 'kmod module could not open modules file at {0}' . format ( conf ) ) else : for mod in lsmod ( ) : mods . add ( mod [ 'module' ] ) return sorted ( list ( mods ) )
return a list of the loaded module names only_persist only return the list of loaded persistent modules cli example: .