관리-도구
편집 파일: __init__.cpython-311.opt-1.pyc
� �EBg � � � d dl Z d dlZd dlZd dlmZ d dlmZmZ d� Zd� Z d� Z d� Ze G d� d � � � � Zdd�Z dS ) � N)� dataclass)�run_command�ExternalProgramFailedc �p � t j | � � }d� |j � � � D � � S )zF Get dict with key-value pairs of default argument values c �T � i | ]%\ }}|j t j j u�||j ��&S � )�default�inspect� Parameter�empty)�.0�k�vs �py/clconfigure/__init__.py� <dictcomp>z%_get_default_args.<locals>.<dictcomp> s= � � � � ��A�q��9�G�-�3�3�3� �1�9�3�3�3� )r � signature� parameters�items)�funcr s r �_get_default_argsr sD � � �!�$�'�'�I�� ��(�.�.�0�0�� � � r c �� � i }|� t | � � � � |� t t | j j |� � � � � � |� |� � |S )zD Get all func arguments including defaults, args and kwargs )�updater �dict�zip�__code__�co_varnames)r �args�kwargs� func_argss r �_get_args_dictr! sk � � �I� ���&�t�,�,�-�-�-� ���T�#�d�m�7��>�>�?�?�@�@�@� ���V�����r c � � � � fd�}|S )z: Simple wrapper that logs execution begin and end c � �� � � �fd�}|S )Nc �� �� t �| |� � }t j �j di |��� � �| i |�� d S # t $ r" t j d �j di |��� � � w xY w)NzFAILED to %sr )r! �logging�info�format� Exception� exception)r r r r �names ��r �wrapped_funcz-task.<locals>.decorator.<locals>.wrapped_func- s� �� �&�t�T�6�:�:�I��L����1�1�y�1�1�2�2�2� ���d�%�f�%�%�%�%�%��� � � ��!�.�+�$�+�2J�2J� �2J�2J�K�K�K�� ���s �= �,A)r )r r+ r* s ` �r � decoratorztask.<locals>.decorator, s* ��� � � � � � � � �r r )r* r, s ` r �taskr- ( s$ �� � � � � � � �r c � � t j | � � }|� t j � � t j |� � }t j d� � |_ t j |_ |� |� � n# t $ r Y nw xY w|j D ][}t |t j � � r?|j t j k r*t j d� � |_ t j |_ �\|S )z& Logger setup for all modules z*[%(levelname)s | %(asctime)s]: %(message)sz$[cloudlinux-customizer]: %(message)s)r% � getLogger�setLevel�DEBUG�FileHandler� Formatter� formatter�level� addHandler�IOError�handlers� isinstance� StreamHandler�stream�sys�stderr�INFO)�logger_name�log_file� app_logger�fh�handlers r �setup_loggerrD 9 s� � � �"�;�/�/�J����� �&�&�&�"� � �� *� *�� �(�8�:� :����=������b�!�!�!�!�� � � � ��� ���� �&� )� )���g�w�4�5�5� )�'�.�C�J�:V�:V� '� 1�2X� Y� Y�G��#�L�G�M���s �B � B�Bc �2 � e Zd ZU dZeed<