Your IP : 18.226.251.94
�
_{�g) � �r � d dl Z d dlmZmZ dZdZdZdZdZdZ d Z
d
ZdZdd
�Z
ed� � d� � � ZdS )� N)�task�run�masked�stopped�unmasked�running�failed�inactive�active�enabled�disabled� is-activec �b � t d|| dz g� � }|j � � � }|S )zZ
Get information about systemctl service state
(either activity or enability)
� systemctl�.service)r �stdout�strip)�service�kind�result�states �py/clconfigure/services.py�get_service_stater s5 � �
�+�t�W�z�%9�:�
;�
;�F��M���!�!�E��L� z<Changing service '{service_name}' state to '{desired_state}'c �h � t |d�� � }t |� � }t j d|||� � d}| t k r|t k rd}n|| t k r|t k rd}nc| t
k r|t k rd}nJ| t k r|t k rd}n1| t k r|t k rd }n| t k r
|t k rd
}|�t j d|� � dS t d||d
z g� � t |� � }t |� � }t j 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�mask�unmask�stop�disable�start�enablez"No actions needed for service '%s'r r zNChecking service '%s' state again... service now is in state='%s' running='%s')r �logging�debug�STATE_MASKED�STATE_UNMASKED�
STATE_STOPPED�STATUS_STOPPED�STATE_DISABLED�
STATE_RUNNING�STATUS_RUNNING�
STATE_ENABLEDr )�
desired_state�service_name�
current_state�current_status�actions r �set_service_stater1 # st � � &�l��F�F�F�M�&�|�4�4�N��M� �"�M�>�C� C� C� �F���$�$��,�)F�)F���� �.� (� (�]�l�-J�-J���� �-� '� '�N�n�,L�,L���� �.� (� (�]�n�-L�-L���� �-� '� '�N�n�,L�,L���� �-� '� '�M�]�,J�,J���
�~��
�:�L�I�I�I�I�I��[�&�,��";�<�=�=�=�)�,�7�7�
�*�<�8�8���
� �&�
�~� G� G� G� G� Gr )r )r"