def mod_list(only_persist=False):
    '''
    Return a list of the loaded module names

    only_persist
        Only return the list of loaded persistent modules

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.mod_list
    '''
    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 __HOLE__:
                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))
dataset/ETHPy150Open saltstack/salt/salt/modules/kmod.py/mod_list