%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZdZ	dZ
dZdZdZ
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zed�Zed�Zd�Zeed�ZdS(u)
Module to manage FreeBSD kernel modules
i(tabsolute_importtunicode_literalstprint_functionNukmodu{0}_load="YES"u/boot/loader.confu^{0}_load="YES"u^(\w+)_load="YES"cC@stddkrtStdfS(u&
    Only runs on FreeBSD systems
    ukerneluFreeBSDuUThe freebsdkmod execution module cannot be loaded: only available on FreeBSD systems.(t
__grains__t__virtualname__tFalse(((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt__virtual__scC@s^t�}t�}x|D]}|j|d�qWx|D]}|j|d�q;W||S(u{
    Return a list of the new modules, pass an kldstat dict before running
    modprobe and one after modprobe has run
    umodule(tsettadd(tpre_modst	post_modstpretposttmod((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt	_new_mods!s		

cC@s^t�}t�}x|D]}|j|d�qWx|D]}|j|d�q;W||S(u{
    Return a list of the new modules, pass an kldstat dict before running
    modprobe and one after modprobe has run
    umodule(RR(R	R
RRR
((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt_rm_mods/s		

cC@s)tjt|�}|r%|jd�SdS(Ni(tretsearcht_MODULES_REtgrouptNone(tlinetmatch((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt_get_module_name=s
cC@s�t�}tjjjtd��[}xQ|D]I}tjjj|�}|j�}t	|�}|r+|j
|�q+q+WWdQX|S(uE
    Returns a list of modules in loader.conf that load on boot.
    urN(Rtsalttutilstfilestfopent_LOADER_CONFtstringutilst
to_unicodetstripRR(tmodstloader_confRtmod_name((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt_get_persistent_modulesDs	
cC@sV|s(|tt�ks(|t�kr/t�Stdttj|��t|g�S(u<
    Add a module to loader.conf to make it persistent.
    ufile.append(tmod_listtTruet	availableRt__salt__Rt_LOAD_MODULEtformat(R
((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt_set_persistent_moduleSs
cC@sm|s|tt�kr t�S|rCtdttj|��ntdttj|�d�t|g�S(uc
    Remove module from loader.conf. If comment is true only comment line where
    module is.
    ufile.commentufile.sedu(R$R%RR'Rt
_MODULE_RER)(R
tcomment((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt_remove_persistent_module^scC@s~g}xqtdddd�D]Y}tjj|�}|jd�}d|kr|jdj||jd� ��qqW|S(u�
    Return a list of all available kernel modules

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.available
    u	file.findu/boot/kerneltnameu*.ko$u.uko(R'tostpathtbasenametsplittappendtjointindex(tretR0tbpathtcomps((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyR&ns
*cC@s
|t�kS(u�
    Check to see if the specified kernel module is available

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.check_available vmm
    (R&(R
((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pytcheck_available�s
cC@s�g}x�tdd�j�D]�}|j�}t|�dksGqn|ddkr]qn|ddkrsqn|ji|dd d	6|d
d6|dd
6�qW|S(u�
    Return a dict containing information about currently loaded modules

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.lsmod
    ucmd.runukldstatiiuIdiukerneli����umoduleiusizeiudepcount(R't
splitlinesR2tlenR3(R6RR8((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pytlsmod�s
	cC@sut�}|r@t�s|SxFt�D]}|j|�q&Wn%x"t�D]}|j|d�qJWtt|��S(u~
    Return a list of the loaded module names

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.mod_list
    umodule(RR#RR<tsortedtlist(tonly_persistR R
((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyR$�s
		cC@s�t�}tddj|�dt�}|ddkr�t�}t||�}t�}|rnt|�}ntt||B��Sd|dkr�|r�|t	�kr�t|�}tt|��Sd	gSn
dj|�Sd	S(
u�
    Load the specified kernel module

    mod
        Name of the module to add

    persist
        Write the module to sysrc kld_modules to make it load on system reboot

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.load bhyve
    ucmd.run_allukldload {0}tpython_shelluretcodeiu"module already loaded or in kernelustderruModule {0} not foundN(R<R'R)RRRR*R=R>R#R(R
tpersistR	tresponseR
R tpersist_mods((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pytload�s 				
cC@s
|t�kS(u�
    Check to see if the specified kernel module is loaded

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.is_loaded vmm
    (R$(R
((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt	is_loaded�s
cC@s�t�}tddj|�dt�}|ddkr�t�}t||�}t�}|rqt||�}ntt||B��Sdj||d�SdS(	uO
    Remove the specified kernel module

    mod
        Name of module to remove

    persist
        Also remove module from /boot/loader.conf

    comment
        If persist is set don't remove line from /boot/loader.conf but only
        comment it

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.remove vmm
    ucmd.run_allu
kldunload {0}R@uretcodeiuError removing module {0}: {1}ustderrN(	R<R'R)RRRR-R=R>(R
RAR,R	tresR
R RC((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pytremove�s				(t__doc__t
__future__RRRR/Rtsalt.utils.filesRRR(RR+RRRRRR#R*R-R&R9R<RR$RDRER%RG(((s</usr/lib/python2.7/site-packages/salt/modules/freebsdkmod.pyt<module>s.										
	%	

Zerion Mini Shell 1.0