
    gU                     ,   d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZm	Z	m
Z
 d dlmZ d dlmZ dZ e j                    ee            Zd Z e
d	ej(                  ej*                  d
eej,                   e	 eddej.                        g      g      Zy)    N)messages)collect_logs)ProArgumentProArgumentGroup
ProCommand)HelpCategory)replace_top_level_logger_namezpro_logs.tar.gzc                z   | j                   xs t        }t        j                         5 }t	        ||       	 t        j                  |d      5 }|j                  |d       d d d        d d d        y# 1 sw Y   xY w# t        $ r'}t        j                  |       Y d }~d d d        yd }~ww xY w# 1 sw Y   yxY w)Nzw:gzzlogs/)arcname   r   )outputPRO_COLLECT_LOGS_FILEtempfileTemporaryDirectoryr   tarfileopenaddPermissionErrorLOGerror)argscfgkwargsoutput_file
output_dirresultses          ;/usr/lib/python3/dist-packages/uaclient/cli/collect_logs.pyaction_collect_logsr      s    ++6!6K		$	$	& *S*%	k62 9gJ89 9 9 	IIaL 
	 sF   B1A>A2!A>2A;	7A>>	B.B)B1)B..B11B:zcollect-logsTz--outputz-o)
short_namehelp)	arguments)r!   descriptionpreserve_descriptionactionhelp_categoryargument_groups)loggingr   r   uaclientr   uaclient.actionsr   uaclient.cli.commandsr   r   r   uaclient.cli.parserr   uaclient.utilr	   r   	getLogger__name__r   r   CLI_ROOT_COLLECT_LOGSCLI_COLLECT_LOGS_DESCTROUBLESHOOTCLI_COLLECT_LOGS_OUTPUTcollect_logs_command     r   <module>r7      s        ) K K , 7) g5h?@
 "		'	'..++#!99	

 r6   