%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/openbsdservice.pyc

�
���^c@@smdZddlmZmZmZddlZddlZddlZddlm	Z	ddl
mZddlZ
ddlZ
eje�ZdZidd6Zd	�Zd
�Zd�Zd�Zdd
�Zd�ZddlZejd�Zejd�Zejd�Zejd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(dS(u$
The service module for OpenBSD

.. important::
    If you feel that Salt should be using this module to manage services on a
    minion, and it is using a different module (or gives an error similar to
    *'service.start' is not available*), see :ref:`here
    <module-provider-override>`.
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tmapuserviceureloadureload_cC@s�tddkr�tjjd�r�tttttdjd����}|ddksz|ddkr�|ddkr�tjjd	�s�tSq�nt	d
fS(u
    Only work on OpenBSD
    uosuOpenBSDu/etc/rc.d/rc.subru
kernelreleaseu.iiiu/usr/sbin/rcctluXThe openbsdservice execution module cannot be loaded: only available on OpenBSD systems.(
t
__grains__tostpathtexiststlistRtinttsplitt__virtualname__tFalse(tkrel((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pyt__virtual__&s"(0
cC@sdj|�}td|�S(u�
    Start the specified service

    CLI Example:

    .. code-block:: bash

        salt '*' service.start <service name>
    u/etc/rc.d/{0} -f startucmd.retcode(tformatt__salt__(tnametcmd((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytstart6s
cC@sdj|�}td|�S(u~
    Stop the specified service

    CLI Example:

    .. code-block:: bash

        salt '*' service.stop <service name>
    u/etc/rc.d/{0} -f stopucmd.retcode(RR(RR((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytstopDs
cC@sdj|�}td|�S(u�
    Restart the named service

    CLI Example:

    .. code-block:: bash

        salt '*' service.restart <service name>
    u/etc/rc.d/{0} -f restartucmd.retcode(RR(RR((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytrestartRs
cC@s�|rttd|��Sttjd|��}|rPtjt�|�}n	|g}i}x8|D]0}dj|�}td|dt�||<qfW|r�|S||S(u]
    Return the status for a service.
    If the name contains globbing, a dict mapping service name to True/False
    values is returned.

    .. versionchanged:: 2018.3.0
        The service name can now be a glob (e.g. ``salt*``)

    Args:
        name (str): The name of the service to check
        sig (str): Signature to use to find the service via ps

    Returns:
        bool: True if running, False otherwise
        dict: Maps service name to True if running, False otherwise

    CLI Example:

    .. code-block:: bash

        salt '*' service.status <service name> [service signature]
    u
status.pidu\*|\?|\[.+\]u/etc/rc.d/{0} -f checkucmd.retcodetignore_retcode(	tboolRtretsearchtfnmatchtfiltertget_allRtTrue(Rtsigtcontains_globbingtservicestresultstserviceR((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytstatus`s	
cC@sdj|�}td|�S(u�
    .. versionadded:: 2014.7.0

    Reload the named service

    CLI Example:

    .. code-block:: bash

        salt '*' service.reload <service name>
    u/etc/rc.d/{0} -f reloaducmd.retcode(RR(RR((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytreload_�su"^\s*(\w[\d\w]*)_flags=(?:(NO)|.*)$u^\s*pkg_scripts=\'(.*)\'$u(\s*start_daemon(?!\(\)))u(?:\s+(\w[\w\d]*))c	C@s�i}y@tjjjdd��"}tjjj|j��}WdQXWntk
rftj	d�ngXxc|D][}t
j|�}|rn|t|j
d��}x$tj|�D]}t||<q�WqnqnWtdddtd	d
dt�jd�}x�|D]�}tj|�}|rH|j
d
�dkr�t||j
d�<q�q�tj|�}|r�x*|j
d�j�D]}t||<qsWq�q�W|S(uM
    Returns a dict where the key is the daemon's name and
    the value a boolean indicating its status (True: enabled or False: disabled).
    Check the daemons started by the system in /etc/rc and
    configured in /etc/rc.conf and /etc/rc.conf.local.
    Also add to the dict all the localy enabled daemons via $pkg_scripts.
    u/etc/rcurNuUnable to read /etc/rciucmd.runu(. /etc/rc.conf && set)t	clean_envtoutput_logleveluquiettpython_shellu
iuNO(tsalttutilstfilestfopentdatatdecodet	readlinestIOErrortlogterrortstart_daemon_call_regextmatchtlentgrouptstart_daemon_parameter_regextfindallRRRtservice_flags_regexR
tpkg_scripts_regex(t
daemons_flagsthandletlinestlineR4tdaemont	variablestvar((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pyt_get_rc�s4%



cC@s4dj|�}tjj|�o3tj|tj�S(u�
    .. versionadded:: 2014.7.0

    Returns ``True`` if the specified service is available, otherwise returns
    ``False``.

    CLI Example:

    .. code-block:: bash

        salt '*' service.available sshd
    u
/etc/rc.d/{0}(RRRtisfiletaccesstX_OK(RR((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pyt	available�s
cC@st|�S(u�
    .. versionadded:: 2014.7.0

    The inverse of service.available.
    Returns ``True`` if the specified service is not available, otherwise returns
    ``False``.

    CLI Example:

    .. code-block:: bash

        salt '*' service.missing sshd
    (RF(R((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytmissing�scC@s\g}tjjd�s|Sx3tjd�D]"}t|�r,|j|�q,q,Wt|�S(u�
    .. versionadded:: 2014.7.0

    Return all available boot services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_all
    u	/etc/rc.d(RRtisdirtlistdirRFtappendtsorted(R!R#((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pyR�scC@s\g}x6tjt��D]"\}}|r|j|�qqWttt��t|�@�S(u�
    .. versionadded:: 2014.7.0

    Return a list of service that are enabled on boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_enabled
    (Rt	iteritemsRBRJRKtsetR(R!R?t
is_enabled((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytget_enableds
cK@s
|t�kS(u�
    .. versionadded:: 2014.7.0

    Return True if the named service is enabled, false otherwise

    CLI Example:

    .. code-block:: bash

        salt '*' service.enabled <service name>
    (RO(Rtkwargs((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytenabled!scC@s\g}x6tjt��D]"\}}|s|j|�qqWttt��t|�@�S(u�
    .. versionadded:: 2014.7.0

    Return a set of services that are installed but disabled

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_disabled
    (RRLRBRJRKRMR(R!R?RN((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytget_disabled0s
cC@s
|t�kS(u�
    .. versionadded:: 2014.7.0

    Return True if the named service is disabled, false otherwise

    CLI Example:

    .. code-block:: bash

        salt '*' service.disabled <service name>
    (RR(R((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pytdisabledCs()t__doc__t
__future__RRRRRtloggingtsalt.extRtsalt.ext.six.movesRtsalt.utils.dataR)tsalt.utils.filest	getLoggert__name__R1Rt__func_alias__RRRRtNoneR$R%RtcompileR9R:R3R7RBRFRGRRORQRRRS(((s?/usr/lib/python2.7/site-packages/salt/modules/openbsdservice.pyt<module>
s>
				(		7						

Zerion Mini Shell 1.0