File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/smf_service.cpython-310.pyc
Back
o ;j�! � @ s� d Z ddlZddlZddiZdZdd� Zd*d d �Zdd� Zd d� Zdd� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zd+dd�Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� ZdS ),am 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>`. � N�reload_�reload�servicec C s$ dt d v rt d dkrdS tS dS )z3 Only work on systems which default to SMF �SolarisZ os_familyZ kernelreleasez5.9)FzHThe smf execution module failed to load: SMF not available on Solaris 9.)FzCThe smf execution module failed to load: only available on Solaris.)Z __grains__�__virtualname__� r r �L/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/smf_service.py�__virtual__ s r �truec C sb t � }d}td |dd��� }|D ]}|�� }|sq|d | kr,|�|d �d�d � qt|�S )z? DRY: Get all service FMRIs and their enabled property z*/usr/bin/svcprop -c -p general/enabled "*"zcmd.run_stdoutF�Zpython_shell� r z/:properties��set�__salt__� splitlines�split�add�sorted)Zenabled_prop�ret�cmd�lines�line�compsr r r �_get_enabled_disabled( s �r c C sT t � } d}td |dd��� }|D ]}|�� }|sqd|v r%| �|d � qt| �S )zw Return the running services CLI Example: .. code-block:: bash salt '*' service.get_running z&/usr/bin/svcs -H -o FMRI,STATE -s FMRI�cmd.runFr �onliner r �r r r r r r r r �get_running8 s �r c C s\ t � } d}td |dd��� }|D ]}|�� }|sqd|vr)d|vr)| �|d � qt| �S )zw Return the stopped services CLI Example: .. code-block:: bash salt '*' service.get_stopped �'/usr/bin/svcs -aH -o FMRI,STATE -s FMRIr Fr r Z legacy_runr r r r r r �get_stoppedN s �r c C s$ d| � �}t d |dd�} | t� v S )a2 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 �/usr/bin/svcs -H -o FMRI r Fr �r �get_all��namer r r r � availabled s r% c C s$ d| � �}t d |dd�} | t� vS )z� 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 r r Fr r! r# r r r �missingw s r&