%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/systemd_service.pyo

�
���^c	@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlmZddlmZeje�Zidd6dd	6Zd?ZdZd
Zd@ZdZd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&dd�Z(d �Z)d!�Z*d"�Z+de,e,d#�Z-d$�Z.d%�Z/d&�Z0d'�Z1d(�Z2d)�Z3d*�Z4d+�Z5d,�Z6d-�Z7d.�Z8d/�Z9e,d0�Z:e,d1�Z;e,d2�Z<e,e,e,d3�Z=e,d4�Z>e,e,e,d5�Z?e,e,e,d6�Z@eAe,e,d7�ZBdd8�ZCe,e,e,d9�ZDe,d:�ZEd;�ZFd<�ZGd=�ZHd>�ZIdS(AuG
Provides the service module for systemd

.. versionadded:: 0.10.0

.. 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(tCommandExecutionError(tsixureloadureload_uunmaskuunmask_u/lib/systemd/systemu/usr/lib/systemd/systemu/etc/systemd/systemu/etc/init.duserviceusocketudeviceumountu	automountuswaputargetupathutimercC@s3tddkr)tjjjt�r)tStdfS(uA
    Only work on systems that have been booted with systemd
    ukerneluLinuxuqThe systemd execution module failed to load: only available on Linux systems which have been booted with systemd.(t
__grains__tsalttutilstsystemdtbootedt__context__t__virtualname__tFalse(((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt__virtual__6s
c@sLt�tj�s$tj���nt�fd�tD��rD�Sd�S(um
    Build a canonical unit name treating unit names without one
    of the valid suffixes as a service.
    c3@s|]}�j|�VqdS(N(tendswith(t.0tsuffix(tname(s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pys	<genexpr>Ksu
%s.service(t
isinstanceRtstring_typest	text_typetanytVALID_UNIT_TYPES(R((Rs@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_canonical_unit_nameDs
cC@s�t|�}tjjjt�}|dk	rU|dkrUd|dkoRdkSS|dj�}d|krutSxatjj	j
|d�D]7}tjd|�}|r�|j
d	�d
k}Pq�q�Wtd|��|S(
uO
    Returns boolean telling whether or not the named service is available
    i�iuretcodeiustdoutucould not be foundu
u\s+loaded:\s+(\S+)iu	not-foundu&Failed to get information on unit '%s'N(t_systemctl_statusRRRtversionR
tNonetlowerRt	itertoolstsplittretmatchtgroupR(Rt_statust
sd_versiontouttlineRtret((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_check_availablePs
cC@sNdj|�}|tkrJt|�s3t|�r=t�ntt|<ndS(u^
    Check for modified/updated unit files, and run a daemon-reload if any are
    found.
    u#systemd._check_for_unit_changes.{0}N(tformatR
t_untracked_custom_unit_foundt_unit_file_changedtsystemctl_reloadtTrue(Rt
contextkey((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_check_for_unit_changesqs

cC@s6|rt|dt�n|r2t|dt�ndS(uf
    Common code for conditionally removing masks before making changes to a
    service's state.
    truntimeN(tunmask_RR+(Rtunmasktunmask_runtime((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt
_check_unmask~scC@sUxNtt�D]@}y#|jd�r5tj|�nWq
tk
rLq
q
Xq
WdS(u
    Remove context
    usystemd._systemctl_status.N(tlistR
t
startswithtpoptAttributeError(tkey((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_clear_context�s
cC@s�ystjjjd��X}xN|D]F}tjjj|�}|jd�r"|jd�dj�}q"q"WWdQXWnt	k
r�dSXyztjjjd��_}xU|D]M}tjjj|�}|jd�r�d	|kr�|jd
�d}q�q�WWdQXWnt	k
rnXy�t
d�}tjjjd��`}xV|D]N}tjjj|�}x0|j�j�D]}||krr|}PqrqrWqDWWdQXWnt	k
r�nX|S(u�
    Try to figure out the default runlevel.  It is kept in
    /etc/init/rc-sysinit.conf, but can be overridden with entries
    in /etc/inittab, or via the kernel command-line at boot
    u/etc/init/rc-sysinit.confuenv DEFAULT_RUNLEVELu=i����Nu2u/etc/inittabu#uinitdefaultu:iu0u1u3u4u5u6usuSu-susingleu
/proc/cmdline(u0u1u2u3u4u5u6usuSu-susingle(RRtfilestfopentstringutilst
to_unicodeR4Rtstript	Exceptiontset(tfp_R$trunlevelt
valid_stringstarg((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_default_runlevel�s:
*

$
	

cC@s�t�}x�ttfD]�}tj|tj�rtjj|�rx{tj|�D]g}y|j	dd�\}}Wnt
k
r�qUnX|tkrU|j|dkr�|n|�qUqUWqqW|S(u4
    Use os.listdir() to get all the unit files
    u.iuservice(
R?tSYSTEM_CONFIG_PATHStLOCAL_CONFIG_PATHtostaccesstR_OKtpathtislinktlistdirtrsplitt
ValueErrorRtadd(R%RJtfullnamet	unit_namet	unit_type((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_get_systemd_services�s	(
-cC@s	ytjt�}Wngtk
r|}|jtjkr:n>|jtjkr_tjdt�ntjd|j|j	�gSX|dkr�t�}ng}xg|D]_}tjtj
jt|�tj�r�||kr�tjd||�q�n|j|�q�q�W|S(uE
    Use os.listdir() and os.access() to get all the initscripts
    u9Unable to check sysvinit scripts, permission denied to %su9Error %d encountered trying to check sysvinit scripts: %suHsysvinit script '%s' found, but systemd unit '%s.service' already existsN(RGRLtINITSCRIPT_PATHtOSErrorterrnotENOENTtEACCEStlogterrortstrerrorRRSRHRJtjointX_OKtdebugtappend(tsystemd_servicest
sysv_servicestexcR%tsysv_service((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_get_sysv_services�s4


$
cC@s�d}|tkryd}xQ|D]+}tjjj|�}|dk	rPqqWtdjdj|����|t|<nt|S(u\
    Returns the path to the sysv service manager (either update-rc.d or
    chkconfig)
    usystemd._get_service_execuupdate-rc.du	chkconfigu/Unable to find sysv service manager (tried {0})u, (uupdate-rc.du	chkconfigN(	R
RRRJtwhichRRR'R\(R,texecutablest
executabletservice_exec((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_get_service_exec�s

cC@sud}|tkrt|Stdddtdt�}y|j�d}Wntk
rft�}nX|t|<|S(u%
    Return the current runlevel
    usystemd._runlevelucmd.runurunleveltpython_shelltignore_retcodei(R
t__salt__RR+Rt
IndexErrorRD(R,R#R%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt	_runlevels


cC@sOg}x3|j�D]%}|jd�s|j|�qqWdj|�j�S(u�
    Strip unnecessary message about running the command with --scope from
    stderr so that we can raise an exception with the remaining stderr text.
    u.scopeu
(t
splitlinesRR_R\R=(tmsgR%R$((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_strip_scope&s
cC@s�g}|rJtjjjt�rJtddt�rJ|jddg�n|jd�|rm|jd�nt	|t
j�r�tj
|�}n|j|�|d
k	r�|jt|��nd|kr�|jdd	g�n|S(un
    Build a systemctl command line. Treat unit names without one
    of the valid suffixes as a service.
    u
config.getu
systemd.scopeusystemd-runu--scopeu	systemctlu
--no-blockustatusu-nu0N(RRRt	has_scopeR
RlR+textendR_RRRtshlexRRR(tactionRt
systemd_scopetno_blockR%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt_systemctl_cmd2s 

cC@sUd|}|tkrt|Stdtd|�dtdtdt�t|<t|S(uq
    Helper function which leverages __context__ to keep from running 'systemctl
    status' more than once.
    usystemd._systemctl_status.%sucmd.run_allustatusRjtredirect_stderrRk(R
RlRxRR+(RR,((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyRIs

cC@sQxJtjdt�|f�D],}tjd|tjj|��rtSqWtS(u�
    A System-V style service is assumed disabled if the "startup" symlink
    (starts with "S") to its script is found in /etc/init.d in the current
    runlevel.
    u/etc/rc%s.d/S*%su	S\d{,2}%s(	tglobRnRRRGRJtbasenameR+R(RR((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt
_sysv_enabledZs#"cC@s;tjjdt|��}tj|tj�o:t|�S(u�
    If the passed service name is not available, but a unit file exist in
    /etc/systemd/system, return True. Otherwise, return False.
    u/etc/systemd/system(RGRJR\RRHRIR&(Rt	unit_path((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyR(gscC@sdt|�dj�kS(uh
    Returns True if systemctl reports that the unit file has changed, otherwise
    returns False.
    u'systemctl daemon-reload'ustdout(RR(R((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyR)qscC@sTtdtd�dtdt�}|ddkrItd|d��nt�tS(	u�
    .. versionadded:: 0.15.0

    Reloads systemctl, an action needed whenever unit files are updated.

    CLI Example:

    .. code-block:: bash

        salt '*' service.systemctl_reload
    ucmd.run_allu--system daemon-reloadRjRyuretcodeiu.Problem performing systemctl daemon-reload: %sustdout(RlRxRR+RR8(R#((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyR*ys	c	C@s0t�}tdtd�dtdt�}x�tjjj|d�D]�}y?|j	�j�}|d}t
|�dkr�|d}nWn#tk
r�}tj
|�qDnX|dkr�qDny|jd	d
�\}}Wntk
r�qDnX|tkrD|j|dkr|n|�qDqDWt|�S(u�
    Return a list of all running services, so far as systemd is concerned

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_running
    ucmd.runu--full --no-legend --no-pagerRjRku
iiurunningu.iuservice(R?RlRxRR+RRRRR=tlenRNRYRZRMRROtsorted(	R%R#R$tcompsRPtactive_stateRbRQRR((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytget_running�s.
		


&cC@s9t�}tdtd�dtdt�}x�tjjj|d�D]�}y"|j	�jd
d�\}}Wntk
r�qDnX|dkr�qDny|jdd�\}}Wntk
r�qDnX|t
krD|j|d	kr�|n|�qDqDW|jtgt�D]}t|�r
|^q
��t|�S(u�
    Return a list of all enabled services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_enabled
    ucmd.runu---full --no-legend --no-pager list-unit-filesRjRku
iuenabledu.userviceN(R?RlRxRR+RRRRR=RRNRMRROtupdateRdR|R(R%R#R$RPt
unit_stateRQRRtx((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytget_enabled�s*
		"

&	,cC@s9t�}tdtd�dtdt�}x�tjjj|d�D]�}y"|j	�jd
d�\}}Wntk
r�qDnX|dkr�qDny|jdd�\}}Wntk
r�qDnX|t
krD|j|d	kr�|n|�qDqDW|jtgt�D]}t|�s
|^q
��t|�S(u�
    Return a list of all disabled services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_disabled
    ucmd.runu---full --no-legend --no-pager list-unit-filesRjRku
iudisabledu.userviceN(R?RlRxRR+RRRRR=RRNRMRROR�RdR|R(R%R#R$RPR�RQRRR�((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytget_disabled�s*
		"

&	,cC@st�}tdtd�dtdt�}x�tjjj|d�D]�}y"|j	�jd
d�\}}Wntk
r�qDnX|dkr�qDny|jdd�\}}Wntk
r�qDnX|t
krD|j|d	kr�|n|�qDqDWt|�S(u�
    .. versionadded:: 2015.8.5

    Return a list of all static services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_static
    ucmd.runu---full --no-legend --no-pager list-unit-filesRjRku
iustaticu.userviceN(R?RlRxRR+RRRRR=RRNRMRROR(R%R#R$RPR�RQRR((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt
get_static	s&		"

&cC@s/t�}|jttd|���t|�S(u
    Return a list of all available services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_all
    R`(RSR�R?RdR(R%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytget_all0s
	cC@st|�t|�S(u�
    .. versionadded:: 0.10.4

    Check that the given service is available taking into account template
    units.

    CLI Example:

    .. code-block:: bash

        salt '*' service.available sshd
    (R-R&(R((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt	available?s
cC@st|�S(u+
    .. versionadded:: 2014.1.0

    The inverse of :py:func:`service.available
    <salt.modules.systemd.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/systemd_service.pytmissingPscC@s�t|�t||�s<tjd||r1dnd�tS|rHdnd}tdt||dt�dtd	t�}|d
dkr�td|��ntS(
u�
    .. versionadded:: 2015.5.0
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Unmask the specified service with systemd

    runtime : False
        Set to ``True`` to unmask this service only until the next reboot

        .. versionadded:: 2017.7.0
            In previous versions, this function would remove whichever mask was
            identified by running ``systemctl is-enabled`` on the service.
            However, since it is possible to both have both indefinite and
            runtime masks on a service simultaneously, this function now
            removes a runtime mask only when this argument is set to ``True``,
            and otherwise removes an indefinite mask.

    CLI Example:

    .. code-block:: bash

        salt '*' service.unmask foo
        salt '*' service.unmask foo runtime=True
    uService '%s' is not %smaskeduruntime-uuunmask --runtimeuunmaskucmd.run_allRvRjRyuretcodeiuFailed to unmask service '%s'(	R-tmaskedRYR^R+RlRxRR(RR.tcmdR#((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyR/as"
		cC@sxt|�|rdnd}tdt||dt�dtdt�}|ddkrttd	|d
|d��ntS(u�
    .. versionadded:: 2015.5.0
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Mask the specified service with systemd

    runtime : False
        Set to ``True`` to mask this service only until the next reboot

        .. versionadded:: 2015.8.5

    CLI Example:

    .. code-block:: bash

        salt '*' service.mask foo
        salt '*' service.mask foo runtime=True
    umask --runtimeumaskucmd.run_allRvRjRyuretcodeiuFailed to mask service '%s'tinfoustdout(R-RlRxR+RR(RR.R�R#((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytmask�s
	
cC@s�t|�|rdnd}tjj|ddt|��}ytj|�dkSWndtk
r�}|jtjkr�t	j
d||�n(|jtjkr�t	jd||�nt
SXdS(	u:
    .. versionadded:: 2015.8.0
    .. versionchanged:: 2015.8.5
        The return data for this function has changed. If the service is
        masked, the return value will now be the output of the ``systemctl
        is-enabled`` command (so that a persistent mask can be distinguished
        from a runtime mask). If the service is not masked, then ``False`` will
        be returned.
    .. versionchanged:: 2017.7.0
        This function now returns a boolean telling the user whether a mask
        specified by the new ``runtime`` argument is set. If ``runtime`` is
        ``False``, this function will return ``True`` if an indefinite mask is
        set for the named service (otherwise ``False`` will be returned). If
        ``runtime`` is ``False``, this function will return ``True`` if a
        runtime mask is set, otherwise ``False``.

    Check whether or not a service is masked

    runtime : False
        Set to ``True`` to check for a runtime mask

        .. versionadded:: 2017.7.0
            In previous versions, this function would simply return the output
            of ``systemctl is-enabled`` when the service was found to be
            masked. However, since it is possible to both have both indefinite
            and runtime masks on a service simultaneously, this function now
            only checks for runtime masks if this argument is set to ``True``.
            Otherwise, it will check for an indefinite mask.

    CLI Examples:

    .. code-block:: bash

        salt '*' service.masked foo
        salt '*' service.masked foo runtime=True
    u/runu/etcusystemdusystemu	/dev/nulluWPath %s does not exist. This is normal if service '%s' is not masked or does not exist.u�Failed to check mask status for service %s. Path %s is a file, not a symlink. This could be caused by changes in systemd and is probably a bug in Salt. Please report this to the developers.N(R-RGRJR\RtreadlinkRURVRWRYttracetEINVALRZR(RR.troot_dirt	link_pathRb((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyR��s$%


cC@srt|�t|||�tdtd|dtd|�dt�}|ddkrntt|d���ntS(	u�
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Start the specified service with systemd

    no_block : False
        Set to ``True`` to start the service using ``--no-block``.

        .. versionadded:: 2017.7.0

    unmask : False
        Set to ``True`` to remove an indefinite mask before attempting to start
        the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            starting. This behavior is no longer the default.

    unmask_runtime : False
        Set to ``True`` to remove a runtime mask before attempting to start the
        service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            starting. This behavior is no longer the default.

    CLI Example:

    .. code-block:: bash

        salt '*' service.start <service name>
    ucmd.run_allustartRvRwRjuretcodeiustderr(R-R2RlRxR+RRRq(RRwR0R1R%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytstart�s*
	cC@s=t|�tdtd|dtd|�dt�ddkS(u�
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Stop the specified service with systemd

    no_block : False
        Set to ``True`` to start the service using ``--no-block``.

        .. versionadded:: 2017.7.0

    CLI Example:

    .. code-block:: bash

        salt '*' service.stop <service name>
    ucmd.run_allustopRvRwRjuretcodei(R-RlRxR+R(RRw((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytstop5s
cC@srt|�t|||�tdtd|dtd|�dt�}|ddkrntt|d���ntS(	u
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Restart the specified service with systemd

    no_block : False
        Set to ``True`` to start the service using ``--no-block``.

        .. versionadded:: 2017.7.0

    unmask : False
        Set to ``True`` to remove an indefinite mask before attempting to
        restart the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            restarting. This behavior is no longer the default.

    unmask_runtime : False
        Set to ``True`` to remove a runtime mask before attempting to restart
        the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            restarting. This behavior is no longer the default.

    CLI Example:

    .. code-block:: bash

        salt '*' service.restart <service name>
    ucmd.run_allurestartRvRwRjuretcodeiustderr(R-R2RlRxR+RRRq(RRwR0R1R%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytrestartVs*
	cC@srt|�t|||�tdtd|dtd|�dt�}|ddkrntt|d���ntS(	u�
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Reload the specified service with systemd

    no_block : False
        Set to ``True`` to reload the service using ``--no-block``.

        .. versionadded:: 2017.7.0

    unmask : False
        Set to ``True`` to remove an indefinite mask before attempting to
        reload the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            reloading. This behavior is no longer the default.

    unmask_runtime : False
        Set to ``True`` to remove a runtime mask before attempting to reload
        the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            reloading. This behavior is no longer the default.

    CLI Example:

    .. code-block:: bash

        salt '*' service.reload <service name>
    ucmd.run_allureloadRvRwRjuretcodeiustderr(R-R2RlRxR+RRRq(RRwR0R1R%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytreload_�s*
	cC@srt|�t|||�tdtd|dtd|�dt�}|ddkrntt|d���ntS(	u@
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    .. versionadded:: 0.12.0

    Force-reload the specified service with systemd

    no_block : False
        Set to ``True`` to start the service using ``--no-block``.

        .. versionadded:: 2017.7.0

    unmask : False
        Set to ``True`` to remove an indefinite mask before attempting to
        force-reload the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            force-reloading. This behavior is no longer the default.

    unmask_runtime : False
        Set to ``True`` to remove a runtime mask before attempting to
        force-reload the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            force-reloading. This behavior is no longer the default.

    CLI Example:

    .. code-block:: bash

        salt '*' service.force_reload <service name>
    ucmd.run_alluforce-reloadRvRwRjuretcodeiustderr(R-R2RlRxR+RRRq(RRwR0R1R%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytforce_reload�s,
	cC@s�ttjd|��}|r6tjt�|�}n	|g}i}xG|D]?}t|�tdtd|�dt	dt
�dk||<qLW|r�|S||S(uM
    Return the status for a service via systemd.
    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): Not implemented

    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\*|\?|\[.+\]ucmd.retcodeu	is-activeRjRki(tboolRtsearchtfnmatchtfilterR�R-RlRxRR+(Rtsigtcontains_globbingtservicestresultstservice((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytstatuss	

c	K@sJt|�t|||�|t�kr�g}tjjjt�rmtddt	�rm|j
ddg�nt�}|jd�r�|j
|d|ddg�n(|jd	�r�|j
||d
g�ntd|dt
d
t	�dkStdtd|dt	d|�dt
d
t	�}|ddkrFtt|d���nt	S(u

    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Enable the named service to start when the system boots

    no_block : False
        Set to ``True`` to start the service using ``--no-block``.

        .. versionadded:: 2017.7.0

    unmask : False
        Set to ``True`` to remove an indefinite mask before attempting to
        enable the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            enabling. This behavior is no longer the default.

    unmask_runtime : False
        Set to ``True`` to remove a runtime mask before attempting to enable
        the service.

        .. versionadded:: 2017.7.0
            In previous releases, Salt would simply unmask a service before
            enabling. This behavior is no longer the default.

    CLI Example:

    .. code-block:: bash

        salt '*' service.enable <service name>
    u
config.getu
systemd.scopeusystemd-runu--scopeu/update-rc.du-fudefaultsu99u
/chkconfiguonucmd.retcodeRjRkiucmd.run_alluenableRvRwuretcodeustderr(R-R2RdRRRRrR
RlR+RsRiRRRxRRq(RRwR0R1tkwargsR�RhR%((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytenable,s,*
	

	c	K@st|�|t�kr�g}tjjjt�r]tddt�r]|j	ddg�nt
�}|jd�r�|j	|d|dg�n(|jd�r�|j	||d	g�ntd
|dtdt�d
kStdt
d|dtd|�dtdt�dd
kS(u�
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `systemd-run(1)`_ is now used to
        isolate commands run by this function from the ``salt-minion`` daemon's
        control group. This is done to avoid a race condition in cases where
        the ``salt-minion`` service is restarted while a service is being
        modified. If desired, usage of `systemd-run(1)`_ can be suppressed by
        setting a :mod:`config option <salt.modules.config.get>` called
        ``systemd.scope``, with a value of ``False`` (no quotes).

    .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html

    Disable the named service to not start when the system boots

    no_block : False
        Set to ``True`` to start the service using ``--no-block``.

        .. versionadded:: 2017.7.0

    CLI Example:

    .. code-block:: bash

        salt '*' service.disable <service name>
    u
config.getu
systemd.scopeusystemd-runu--scopeu/update-rc.du-furemoveu
/chkconfiguoffucmd.retcodeRjRkiucmd.run_alludisableRvRwuretcode(R-RdRRRRrR
RlR+RsRiRRRx(RRwR�R�Rh((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytdisablets$
	

cK@s�tdtd|�dtdt�dkr/tSd|kr|dtd|d	d
ddg}ttd
|dt��r�tSn|t�kr�t|�StS(u�
    Return if the named service is enabled to start on boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.enabled <service name>
    ucmd.retcodeu
is-enabledRjRkiu@ufindu-nameu-typeulu-printu-quitucmd.run(RlRxRR+RFR�RdR|(RR�R�((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytenabled�s

cC@st|�S(u�
    Return if the named service is disabled from starting on boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.disabled <service name>
    (R�(R((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytdisabled�s
cC@s&i}tdtd|�dt�}x�tjjj|d�D]�}|jd�}|d}dj|d�}|jd�r�|j	dd	�j	d
d	�}i||<xt|jd�D]7}|jd�}|dj
�|||dj
�<q�Wq>|dkr|j�||<q>|||<q>W|S(u�
    .. versionadded:: 2014.7.0

    Show properties of one or more units/jobs or the manager

    CLI Example:

        salt '*' service.show <service name>
    ucmd.runushowRju
u=iiu{uu}u ; uBeforeuAfteruWants(uBeforeuAfteruWants(RlRxRRRRRR\R4treplaceR=(RR%R#R$R�tvaluetitem((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytshow�s"
	

)cC@sNi}xAt�D]6}t|�}d|kr4qn|dd||<qW|S(u�
    .. versionadded:: 2014.7.0

    Return a list of all files specified as ``ExecStart`` for all services.

    CLI Example:

        salt '*' service.execs
    u	ExecStartupath(R�R�(R%R�tdata((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pytexecs�s
(u/lib/systemd/systemu/usr/lib/systemd/system(	userviceusocketudeviceumountu	automountuswaputargetupathutimer(Jt__doc__t
__future__RRRRVRztloggingRGR�RRttsalt.utils.filesRtsalt.utils.itertoolstsalt.utils.pathtsalt.utils.stringutilstsalt.utils.systemdtsalt.exceptionsRtsalt.extRt	getLoggert__name__RYt__func_alias__RERFRTRRR
RR&R-R2R8RDRSRRdRiRnRqRRxRR|R(R)R*R�R�R�R�R�R�R�R/R�R�R�R�R�R�R+R�R�R�R�R�R�R�R�(((s@/usr/lib/python2.7/site-packages/salt/modules/systemd_service.pyt<module>s�
			!	
			-	'					
	
			'	(	(	'			3,=8!88=)H1	!	
	

Zerion Mini Shell 1.0