%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/smf_service.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZidd6ZdZd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS(um
Service support for Solaris 10 and 11, should work with other systems
that use SMF also. (e.g. SmartOS)

.. 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_importtunicode_literalstprint_functionNureloadureload_uservicecC@s8dtdkr.tddkr*tdfStStdfS(u3
    Only work on systems which default to SMF
    uSolarisu	os_familyu
kernelreleaseu5.9uHThe smf execution module failed to load: SMF not available on Solaris 9.uCThe smf execution module failed to load: only available on Solaris.(t
__grains__tFalset__virtualname__(((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pyt__virtual__s

utruecC@s�t�}d}td|dt�j�}xW|D]O}|j�}|sPq2n|d|kr2|j|djd�d�q2q2Wt|�S(u?
    DRY: Get all service FMRIs and their enabled property
    u*/usr/bin/svcprop -c -p general/enabled "*"ucmd.run_stdouttpython_shelliiu/:properties(tsett__salt__Rt
splitlinestsplittaddtsorted(tenabled_proptrettcmdtlinestlinetcomps((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pyt_get_enabled_disabled&s	
%cC@s~t�}d}td|dt�j�}xF|D]>}|j�}|sPq2nd|kr2|j|d�q2q2Wt|�S(uw
    Return the running services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_running
    u&/usr/bin/svcs -H -o FMRI,STATE -s FMRIucmd.runRuonlinei(RR	RR
RRR
(RRRRR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytget_running6s
	
cC@s�t�}d}td|dt�j�}xR|D]J}|j�}|sPq2nd|kr2d|kr2|j|d�q2q2Wt|�S(uw
    Return the stopped services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_stopped
    u'/usr/bin/svcs -aH -o FMRI,STATE -s FMRIucmd.runRuonlineu
legacy_runi(RR	RR
RRR
(RRRRR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytget_stoppedLs
	
cC@s2dj|�}td|dt�}|t�kS(u2
    Returns ``True`` if the specified service is available, otherwise returns
    ``False``.

    We look up the name with the svcs command to get back the FMRI
    This allows users to use simpler service names

    CLI Example:

    .. code-block:: bash

        salt '*' service.available net-snmp
    u/usr/bin/svcs -H -o FMRI {0}ucmd.runR(tformatR	Rtget_all(tnameR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pyt	availablebscC@s2dj|�}td|dt�}|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 net-snmp
    u/usr/bin/svcs -H -o FMRI {0}ucmd.runR(RR	RR(RR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytmissinguscC@sit�}d}td|�j�}x7|D]/}|j�}|sJq,n|j|d�q,Wt|�S(uu
    Return all installed services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_all
    u'/usr/bin/svcs -aH -o FMRI,STATE -s FMRIucmd.runi(RR	R
RRR
(RRRRR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pyR�s
	
cC@swdj|�}td|dt�}|s/tS|dkrsdj|�}td|dt�td|dt�StS(u�
    Start the specified service

    CLI Example:

    .. code-block:: bash

        salt '*' service.start <service name>
    u!/usr/sbin/svcadm enable -s -t {0}ucmd.retcodeRiu/usr/sbin/svcadm clear {0}(RR	RtTrue(RRtretcodet	clear_cmd((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytstart�s
cC@s$dj|�}td|dt�S(u~
    Stop the specified service

    CLI Example:

    .. code-block:: bash

        salt '*' service.stop <service name>
    u"/usr/sbin/svcadm disable -s -t {0}ucmd.retcodeR(RR	R(RR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytstop�s
cC@s3dj|�}td|dt�s/t|�StS(u�
    Restart the named service

    CLI Example:

    .. code-block:: bash

        salt '*' service.restart <service name>
    u/usr/sbin/svcadm restart {0}ucmd.retcodeR(RR	RR(RR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytrestart�s

cC@s3dj|�}td|dt�s/t|�StS(u~
    Reload the named service

    CLI Example:

    .. code-block:: bash

        salt '*' service.reload <service name>
    u/usr/sbin/svcadm refresh {0}ucmd.retcodeR(RR	RR(RR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytreload_�s

cC@s�ttjd|��}|r6tjt�|�}n	|g}i}xC|D];}dj|�}td|dt�}|dk||<qLW|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): 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>
    u\*|\?|\[.+\]u/usr/bin/svcs -H -o STATE {0}ucmd.runRuonline(	tbooltretsearchtfnmatchtfilterRRR	R(Rtsigtcontains_globbingtservicestresultstserviceRR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytstatus�s	
cK@s$dj|�}td|dt�S(u�
    Enable the named service to start at boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.enable <service name>
    u/usr/sbin/svcadm enable {0}ucmd.retcodeR(RR	R(RtkwargsR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytenables
cK@s$dj|�}td|dt�S(u�
    Disable the named service to start at boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.disable <service name>
    u/usr/sbin/svcadm disable {0}ucmd.retcodeR(RR	R(RR.R((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytdisables
cK@sldj|�}td|dt�}dj|�}td|dt�j�}|ddkrdtStSdS(u�
    Check to see if the named service is enabled to start on boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.enabled <service name>
    u/usr/bin/svcs -H -o FMRI {0}ucmd.runRu0/usr/sbin/svccfg -s {0} listprop general/enablediutrueN(RR	RRR(RR.tfmri_cmdtfmriRR((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytenabled's
cC@st|�S(u�
    Check to see if the named service is disabled to start on boot

    CLI Example:

    .. code-block:: bash

        salt '*' service.disabled <service name>
    (R3(R((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytdisabled>s
cC@s
td�S(uw
    Return the enabled services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_enabled
    utrue(R(((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytget_enabledKscC@s
td�S(uy
    Return the disabled services

    CLI Example:

    .. code-block:: bash

        salt '*' service.get_disabled
    ufalse(R(((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pytget_disabledYs(t__doc__t
__future__RRRR&R$t__func_alias__RRRRRRRRRR R!R"tNoneR-R/R0R3R4R5R6(((s</usr/lib/python2.7/site-packages/salt/modules/smf_service.pyt<module>s0
										&				
	

Zerion Mini Shell 1.0