3 \�me8 � + @ s d Z ddlZddlZddlmZ ddlmZmZ y ddlm Z m Z mZmZ dZ W n ek rh dZ Y nX dd d ddd ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*g#Zd+Zd,Zed-�d.d/�Zd@d0d1�ZdAd2d3�ZdBd4d5�ZdCd6d7�ZdDd8d9�ZdEd:d;�Zd<d=� Zd>d?� ZdS )FzCloud-init apport interface� N)�read_cfg_paths)�INSTALLER_APPORT_FILES� INSTALLER_APPORT_SENSITIVE_FILES)�attach_file�attach_file_if_exists�attach_root_command_outputs�root_command_outputTFZAliYunZAltCloudZAkamaizAmazon - Ec2ZAzureZBigstepZ BrightboxZ CloudSigmaZ CloudStackZDigitalOceanZE24CloudzGCE - Google Compute EnginezHuawei CloudZExoscalez Hetzner CloudZNWCSz IBM - (aka SoftLayer or BlueMix)ZLXDZMAASZNoCloudZ OpenNebulaZ OpenStackZOracleZOVFz'RbxCloud - (HyperOne, Rootbox, Rubikon)ZOpenTelekomCloudzSAP Converged CloudZScalewayZSmartOSZUpCloudZVMwareZVultrZZStackZOutscaleZOtherz/var/log/cloud-init.logz/var/log/cloud-init-output.log)�returnc C s t � } | jd�S )NZuserdata_raw)r Z get_ipath_cur)�paths� r �/usr/lib/python3.6/apport.py�_get_user_data_fileH s r c C s0 t | ddd�� tddddg� t| dd� d S ) zBAttach cloud-init logs and tarfile from 'cloud-init collect-logs'.z-egrep -i "warn|error" /var/log/cloud-init.logz"cat /var/log/cloud-init-output.log)zcloud-init-log-warningszcloud-init-output.log.txtz cloud-initzcollect-logsz-tz/tmp/cloud-init-logs.tgzzlogs.tgzN)r r r )�report�uir r r �attach_cloud_init_logsM s r c C s$ d}|r |j |�r t| ddi� dS )z*Optionally attach hardware info from lshw.z�Your device details (lshw) may be useful to developers when addressing this bug, but gathering it requires admin privileges. Would you like to include this info?zlshw.txtZlshwN)�yesnor )r r �promptr r r � attach_hwinfo^ s r c C s� |r�t � }y(t|jd���}tj|�}dS Q R X W n ttjjtfk rP Y nX d}|j |�}|dkrlt �|r�d}|j|t�}|r�t|d | d<