Edit File: services.cpython-37.pyc
B 5/9e8 � @ sZ d dl mZ d dlZd dlmZmZ dZdZdZdZ dZ d Zddd�Zed �dd� �Z dS )� )�absolute_importN)�task�runZmaskedZstoppedZunmaskedZrunningZinactiveZactive� is-activec C s t d|| d g�}|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_state s r z<Changing service '{service_name}' state to '{desired_state}'c C s� t |dd�}t |�}t�d|||� d}| tkr>|tkr>d}n@| tkrT|tkrTd}n*| tkrj|tkrjd}n| tkr~|tkr~d}|dkr�t�d |� n2t d ||d g� 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'r z.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_stateZservice_nameZ current_stateZcurrent_status�actionr r r �set_service_state s( r )r )Z __future__r r Zclconfigurer r r r r r r r r r r r r r �<module> s