%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/system-config-printer/troubleshoot/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/system-config-printer/troubleshoot/__pycache__/ErrorLogFetch.cpython-312.pyc

�

HfM���ddlmZddlZddlZddlmZddlZddlZddlm	Z	ddl
�	ddlmZGd	�d
e
�Zy#dZY�xYw)�)�GtkN)�NamedTemporaryFile)�TimedOperation�)�*)�journalFc�$�eZdZd�Zd�Zd�Zd�Zy)�
ErrorLogFetchc�P�tj||d�|jtd�td��}t	j
�|_|jjd�|j|jddd�|j||�i|_
y)NzError log fetchzRetrieve Journal Entriesz�No system journal entries were found. This may be because you are not an administrator. To fetch journal entries please run this command:Fr)�Question�__init__�initial_vbox�_r�Entry�entry�set_editable�
pack_start�new_page�persistent_answers)�self�troubleshooter�pages   �>/usr/share/system-config-printer/troubleshoot/ErrorLogFetch.pyr
zErrorLogFetch.__init__'s������4��1B�C�� � �!�$>�"?�"#�%?�#@�A��
�Y�Y�\��
��
�
����'�������U�E�1�5�����t�,�"$���c���|jj}|jj�}i|_|jd�}|jd�}|jd�}d|jvsd|jvrd}d}d�}t
j
j
tj��jd�}|jjd|_	d	|vr�	t|jj|�
�|_|jj�}d|tj <|d
}	|	jdd�|d<d}
d�}	t||j|f|�
�|_|jj�d|jd<i|_t"r_|�]d�}t#j$�}
|
j'|�|
j)d��|
D�cgc]
}||���c}|jd<|��t||jf|�
�|_|jj�}|�ft+|�}|j-|�|j/�}t1j2|�d|D�cgc]}|j5���c}i|_t7|jjdg��t7|jjdg��zdk(r%d|�d|�d�}|j8j;|�yy#tj$rYywxYw#tj$rY���wxYwcc}wcc}w)N�error_log_checkpoint�error_log_cursor�error_log_timestamp�	error_logrc��|j�}|jd�|j�td��5}d}	|j	d|��d}|j|�|r|jcddd�S	ddd�y#t
j$r3	tj|j�n#t$rYnwxYwY�wwxYw#1swYyxYw)NF)�deletez/admin/log/error_log)�fileT)�_get_prompt_allowed�_set_prompt_allowed�_connectr�getFile�cups�	HTTPError�os�remove�name�OSErrorr")�c�prompt�tmpf�successs    r�	fetch_logz(ErrorLogFetch.display.<locals>.fetch_logAs����*�*�-�F�
�!�!�5�)�
�J�J�M�#�E�2�

%�d�����I�I�5�d�I�C�"�G��%�%�v�.���9�9�

%�

%��

%����~�~����	�	�4�9�9�-��"�������

%��sS�C�B	�C�	C�B=�<C�=	C	�C�C	�	C�C�C�C�Cz%F %T�_authenticated_connection�error_log_debug_logging_set)�parentF�0�cups_server_settings�
MaxLogSize�2000000c��|j|�d}|dkr(	tjd�|j�yyy#t$r|dz
}YnwxYw|dkr�C�)Nr�)�adminSetServerSettings�time�sleepr%�RuntimeError)�
connection�settings�attempts   r�set_settingsz+ErrorLogFetch.display.<locals>.set_settingsdsg���1�1�8�<�����l�%��
�
�A��"�+�+�.���	#��
(�%��1���%����l�s�%A�A�AT�error_log_debug_logging_unsetc��	d|d}|dz|djd�zdz|dzS#ttf$rd}Y�6wxYw)N�	XACEWNIDd�PRIORITY� �__REALTIME_TIMESTAMPz
[%m/%b/%Y:%T]�MESSAGE)�
IndexError�	TypeError�strftime)�x�prioritys  r�journal_formatz-ErrorLogFetch.display.<locals>.journal_format~sl��#�*�1�Z�=�9�H�!�3���0�1�:�:�?�K�L����	�l�+�,��#�I�.�#�"�H�#�s�-�A�Azcups.service)�
_SYSTEMD_UNITrz+su -c 'journalctl -u cups.service --since="z" --until="z"' > troubleshoot-logs.txt)r�answers�
get_window�getr�datetime�
fromtimestampr<rL�authconnr�adminGetServerSettings�op�runr'�IPPError�CUPS_SERVER_DEBUG_LOGGINGr�Reader�seek_cursor�	add_match�open�seek�	readlinesr)r*�strip�lenr�set_text)rrQr4�
checkpoint�cursor�	timestampr1�nowr@�
orig_settingsr0rBrO�rrM�tmpfname�f�lines�cmds                   r�displayzErrorLogFetch.display4s����%�%�-�-���$�$�/�/�2������[�[�"8�9�
����0�1���K�K�!6�7�	��4�2�2�2���0�0�0��J��F�	�*���-�-�t�y�y�|�<�E�E�w�O���+�+�3�3�4O�P��
�(�G�3�
�(�$�-�-�*N�*N�17�9����7�7�;�;�>��8;�H�T�3�3�4�#�$:�;�M�%2�%6�%6��i�%P�H�\�"��G�
%�
�(�,�+/�=�=�(�*C�17�9���������KO��'�'�(G�H�����v�)�
,����!�A�
�M�M�6�"�
�K�K�~�K�6�CD�&E�a�~�q�'9�&E�D�L�L��#��!�$�i�'+�}�}�&6�-3�5�D�G��w�w�{�{�~�H��#��(�O�����
�#�������	�	�8�$�!,�5�.I�a�q�w�w�z�.I�K�������!�!�9�b�1�2�����!�!�;��3�4�
5�9:�;��s�$�C�
�J�J����%����I�=�=�
��
��8�=�=�
��
��$'F��/Js2�1AL.�$AM�9M!�M&�.M�M�M�Mc�p�|jj�}|j|j�|S)N)r�copy�updaterQ)rrQs  r�collect_answerzErrorLogFetch.collect_answer�s+���)�)�.�.�1��������%��rc���|jj�|jj}|d}|j	�|_|j
|jd<y)N�!_authenticated_connection_factoryr2)rX�cancelrrQ�get_connectionrV)rrQ�factorys   r�cancel_operationzErrorLogFetch.cancel_operation�sQ���������%�%�-�-���=�>���.�.�1��
�48�M�M����0�1rN)�__name__�
__module__�__qualname__r
rorsry�rrr
r
&s��%�m�^�
Brr
)�
gi.repositoryrr'r)�tempfilerrTr<�timedopsr�base�systemdrrr
r}rr�<module>r�sC��.��	�'���#����IB�H�IB����G�s	�;�A

Zerion Mini Shell 1.0