BYPASS SHELL BY ./RAZORGANZ
Server: nginx/1.20.1
System: Linux iZdzfnv9mwfppeZ 5.10.134-19.2.al8.x86_64 #1 SMP Wed Oct 29 22:47:09 CST 2025 x86_64
User: apache (48)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/cloudinit/__pycache__/apport.cpython-36.opt-1.pyc
3

�q�h��*@sdZddlZddlZddlmZddlmZmZy ddlm	Z	m
Z
mZmZdZ
Wnek
rhdZ
YnXdd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)g"Zd*Zd+Zed,�d-d.�Zd=d/d0�Zd>d1d2�Zd?d3d4�Zd@d5d6�ZdAd7d8�Zd9d:�Zd;d<�ZdS)BzCloud-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_outputTFZAliYunZAltCloudzAmazon - Ec2ZApsaraAzureZBigstepZ	BrightboxZ
CloudSigmaZ
CloudStackZDigitalOceanZE24CloudzGCE - Google Compute EnginezHuawei 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)�returncCst�}|jd�S)NZuserdata_raw)rZ
get_ipath_cur)�paths�r�/usr/lib/python3.6/apport.py�_get_user_data_fileHsr
cCs0t|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-initzcollect-logsz-tz/tmp/cloud-init-logs.tgzzlogs.tgzN)rrr)�report�uirrr�attach_cloud_init_logsMs
rcCs$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)rr�promptrrr�
attach_hwinfo^srcCs�|r�t�}y(t|jd���}tj|�}dSQRXWnttjjtfk
rPYnXd}|j	|�}|dkrlt
�|r�d}|j|t�}|r�t|d|d<nd|d<dS)a�Prompt for cloud details if instance-data unavailable.

    When we have valid _get_instance_data, apport/generic-hooks/cloud_init.py
    provides CloudName, CloudID, CloudPlatform and CloudSubPlatform.

    Apport/generic-hooks are delivered by cloud-init's downstream branches
    ubuntu/(devel|kinetic|jammy|focal|bionic) so they will not be represented
    in upstream main.

    In absence of viable instance-data.json format, prompt for the cloud below.
    �
instance_dataNz/Is this machine running in a cloud environment?zOPlease select the cloud vendor or environment in which this instance is runningrZ	CloudName�None)
r�openZget_runpath�json�load�IOError�decoderZJSONDecodeError�AssertionErrorr�
StopIterationZchoice�KNOWN_CLOUD_NAMES)rrr
�filerr�responserrr�attach_cloud_infois$


r cCs.x(tD] }tjj|j�}t|||j�qWdS)a Attach any subiquity installer logs config.

    To support decoupling apport integration from installer config/logs,
    we eventually want to either source this function or APPORT_FILES
    attribute from subiquity  and/or ubuntu-desktop-installer package-hooks
    python modules.
    N)r�os�path�realpathr�label)rr�apport_filer#rrr�attach_installer_files�s
r&cCst|rpt�}dj|�}|j|�}|dkr*t�|rptjj|�}t||d�x(tD] }tjj|j�}t	|||j
�qLWdS)z(Optionally provide user-data if desired.z�Your user-data, cloud-config or autoinstall files can optionally  be provided from {0} and could be useful to developers when addressing this bug. Do you wish to attach user-data to this bug?Nz
user_data.txt)r
�formatrrr!r"r#rrrr$)rrZuser_data_filerrr#r%rrr�attach_user_data�s

r(cCs�g}|jd�r|jd�|jd�r,|jd�d|j�krR|d}d|krR|jd�|jd�rf|jd	�|r�|jd
d�|d
r�|d
d7<|d
dj|�7<d
S)z$Add any appropriate tags to the bug.ZCurtinErrorZcurtinZSubiquityLogZ	subiquityZ
JournalErrorszBreaking ordering cyclezsystemd-orderingZUdiLogzubuntu-desktop-installerZTags�� N)�get�append�keys�
setdefault�join)rZnew_tags�errorsrrr�add_bug_tags�s 






r1cCsJtstd��t||�t||�t||�t||�t||�t|�dS)a-This is an entry point to run cloud-init's apport functionality.

    Distros which want apport support will have a cloud-init package-hook at
    /usr/share/apport/package-hooks/cloud-init.py which defines an add_info
    function and returns the result of cloudinit.apport.add_info(report, ui).
    z;No apport imports discovered. Apport functionality disabledT)�
has_apport�RuntimeErrorrrr r(r&r1)rrrrr�add_info�s




r4)N)N)N)N)N)�__doc__rr!Zcloudinit.cmd.develrZcloudinit.cmd.devel.logsrrZapport.hookutilsrrrrr2�ImportErrorrZ
CLOUDINIT_LOGZCLOUDINIT_OUTPUT_LOG�strr
rrr r&r(r1r4rrrr�<module>sj



(