| Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clconfigure/__pycache__/packages.cpython-311.pyc |
�
��oe � �z � d dl mZ d dlZd dlZd dlZd dlmZmZ dZdZ dZ
ed� � d� � � Zd � Zd
� Z
dS )� )�absolute_importN)�task�run�uninstalled� installedzis not installedz<Changing package '{package_name}' state to '{desired_state}'c � � t |� � }t j d||� � | |k rt j d|� � dS t j d� � | t k rd}n| t
k rd}nt
� � �t d|d|g� � t |� � }t j d ||� � | |k rt d
� � �dS )z�
Brings package to given state (installed | uninstalled). May be executed more that once,
does't crash on future calls
z7Checking package '%s' state... package is in state '%s'z"No actions needed for package '%s'Nz(State does not match target, changing...�remove�install�yumz-yzAChecking package '%s' state again... package is now in state '%s'zFailed to do required actions) �_get_package_state�logging�debug�info�
STATE_REMOVED�STATE_INSTALLED�NotImplementedErrorr �RuntimeError)�
desired_state�package_name�
current_state�actions �py/clconfigure/packages.py�set_package_stater s� � � '�|�4�4�M��M�K�\�[h�i�i�i��
�%�%��
�:�L�I�I�I����L�;�<�<�<��
�%�%���� �/� )� )����!�#�#�#�����l�+�,�,�,�&�|�4�4�M��L�T�Vb�dq�r�r�r��
�%�%��:�;�;�;� &�%� c � � t dd| g� � }t |j v rt S |j dk rt
S t
d| z � � �)zJ
Gets current package state.
Either installed or uninstalled.
�rpmz-qr zUnknown package %s status)r �_PACKAGE_NOT_INSTALLED�stdoutr �exitcoder r )�package�resps r r r . sR � �
��t�W�%�&�&�D����,�,���
��!� � ���
�2�W�<�
=�
=�=r c �>