HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/clconfigure/__pycache__/services.cpython-37.pyc
B

RcCw���@s^ddlmZddlZddlmZmZdZdZdZdZ	dZ
d	Zd
Zddd
�Z
ed�dd��ZdS)�)�absolute_importN)�task�runZmaskedZstoppedZunmaskedZrunningZfailedZinactiveZactive�	is-activecCs td||dg�}|j��}|S)zZ
    Get information about systemctl service state
    (either activity or enability)
    �	systemctlz.service)r�stdout�strip)Zservice�kind�result�state�r�py/clconfigure/services.py�get_service_states
rz<Changing service '{service_name}' state to '{desired_state}'cCs�t|dd�}t|�}t�d|||�d}|tkr>|tkr>d}n@|tkrT|tkrTd}n*|tkrj|tkrjd}n|tkr~|tkr~d}|dkr�t�d	|�n2t	d
||dg�t|�}t|�}t�d|||�dS)
zi
    Brings service to given state. May be executed more that once,
    does't crash on future calls
    z
is-enabled)r	zDChecking service '%s' state... package is in state='%s' running='%s'N�maskZunmask�stop�startz"No actions needed for service '%s'rz.servicezNChecking service '%s' state again... service now is in state='%s' running='%s')
r�logging�debug�STATE_MASKED�STATE_UNMASKED�
STATE_STOPPED�STATUS_STOPPED�
STATE_RUNNING�STATUS_RUNNINGr)Z
desired_stateZservice_nameZ
current_stateZcurrent_status�actionrrr
�set_service_state!s(
r)r)Z
__future__rrZclconfigurerrrrrrZSTATE_FAILEDrrrrrrrr
�<module>s