https://t.me/RX1948
Server : nginx/1.24.0
System : Linux ip-172-31-33-48 6.14.0-1011-aws #11~24.04.1-Ubuntu SMP Fri Aug 1 02:07:25 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
Directory :  /lib/python3/dist-packages/cloudinit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/cloudinit/__pycache__/apport.cpython-312.pyc
�

x[h0!���dZddlZddlZddlZddlmZddlmZmZddl	m
Z
	ddlmZm
Z
mZmZdZgd	�Zdd
�Zdd�Zdd�Zdd
�Zddefd�Zd�Zd�Zdeeeffd�Zdeeeffd�Zeed�Zdeddfd�Zdd�Z y#e$rdZY�RwxYw)zCloud-init apport interface�N)�Dict)�INSTALLER_APPORT_FILES� INSTALLER_APPORT_SENSITIVE_FILES)�is_cloud_init_enabled)�attach_file�attach_file_if_exists�attach_root_command_outputs�root_command_outputTF)&�AliYun�AltCloud�AkamaizAmazon - Ec2�Azure�Bigstep�	Brightbox�CloudCIX�
CloudSigma�
CloudStack�DigitalOcean�E24CloudzGCE - Google Compute EnginezHuawei Cloud�Exoscalez
Hetzner Cloud�NWCSz IBM - (aka SoftLayer or BlueMix)�LXD�MAAS�NoCloud�
OpenNebula�	OpenStack�Oracle�OVFz'RbxCloud - (HyperOne, Rootbox, Rubikon)�OpenTelekomCloudzSamsung Cloud PlatformzSAP Converged Cloud�Scaleway�SmartOS�UpCloud�VMware�Vultr�ZStack�Outscale�WSL�Otherc�~�t|ddi�gd�}|s|jd�t|�t|dd�y)zBAttach cloud-init logs and tarfile from 'cloud-init collect-logs'.zcloud-init-log-warningsz-egrep -i "warn|error" /var/log/cloud-init.log)z
cloud-initzcollect-logsz-t�/tmp/cloud-init-logs.tgzz--redactr*zlogs.tgzN)r	�appendr
r)�report�ui�include_sensitive�commands    �2/usr/lib/python3/dist-packages/cloudinit/apport.py�attach_cloud_init_logsr1IsE����%�?�	
���G�����z�"��� ���2�J�?�c�N�d}|r!|j|�rt|ddi�yyy)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.txt�lshwN)�yesnor	)r,r-�prompts   r0�
attach_hwinfor7_s2��	0��

�b�h�h�v��#�F�Z��,@�A��rr2c�6�tD]B}tjj|j�}t	|||j
��D|rLtD]B}tjj|j�}t	|||j
��Dyy)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�labelr)r,r-r.�apport_filer;s     r0�attach_installer_filesr>js���.�C���7�7�#�#�K�$4�$4�5���f�h��0A�0A�B�C��;�	G�K��w�w�'�'��(8�(8�9�H�!�&�(�K�4E�4E�F�	G�r2c��tjjd�}t||�tjj	|�r2|jdd�|dr
|dxxdz
cc<|dxxdz
cc<yy)z<Attach ubuntu pro logs and tag if keys present in user-data.z/var/log/ubuntu-advantage.log�Tags�� z
ubuntu-proN)r9r:r;r�exists�
setdefault)r,r-r;s   r0�attach_ubuntu_pro_inforE{si���w�w��� ?�@�H��&�(�+�	�w�w�~�~�h�����&�"�%��&�>��6�N�c�!�N��v��,�&��	 r2�returnc�B�|syd}|j|�}|�t�|S)z(Optionally provide user-data if desired.FaQYour user data, cloud-config, network config, or autoinstall files can optionally be provided and could be useful to developers when addressing this bug. However, this data should not be included if it contains any sensitive data such as passwords and secrets. Gathering it requires admin privileges. Would you like to include this info?)r5�
StopIteration)r,r-r6�responses    r0�can_attach_sensitiverJ�s3��
��	/���x�x���H������Or2c��g}|jd�r|jd�|jd�r|jd�d|j�vr|d}d|vr|jd�|jd�r|jd	�|rA|jd
d�|d
r
|d
xxdz
cc<|d
xxdj	|�z
cc<y
y
)z$Add any appropriate tags to the bug.�CurtinError�curtin�SubiquityLog�	subiquity�
JournalErrorszBreaking ordering cyclezsystemd-ordering�UdiLogzubuntu-desktop-installerr@rArBN)�getr+�keysrD�join)r,�new_tags�errorss   r0�add_bug_tagsrW�s����H�
�z�z�-� �����!�
�z�z�.�!�����$��&�+�+�-�'���(��$��.��O�O�.�/�
�z�z�(�����2�3�����&�"�%��&�>��6�N�c�!�N��v��#�(�(�8�,�,��	r2c��tstd��t||�}t|||�t	||�t|||�t
||�t|�y)a-This is an entry point to run cloud-init's package-specific hook

    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�RuntimeErrorrJr1r7r>rErW)r,r-r.s   r0�add_infor[�s_����I�
�	
�-�V�R�8���6�2�'8�9��&�"���6�2�'8�9��6�2�&����r2c���|jdi�jdi�jd�}|siSdddddd	�}i}|j�D]
\}}||||<�|S)
N�	meta_data�imds�compute�ImagePublisher�
ImageOffer�ImageSKU�ImageVersion�VMSize)�	publisher�offer�sku�version�vmSize�rR�items)�ds_datar_�name_to_report_map�
azure_data�src_key�report_key_names      r0�_get_azure_datarq�s����k�k�+�r�*�.�.�v�r�:�>�>�y�I�G���	�%���!�����J�$6�$<�$<�$>�7� ���&-�g�&6�
�?�#�7��r2c���|jdi�jdi�jd�}|siShd�}|j�D��cic]
\}}||vs�||��c}}Scc}}w)N�dynamiczinstance-identity�document>�region�imageId�architecture�instanceType�billingProductsrj)rlrt�wanted_keys�key�values     r0�
_get_ec2_datar}�st�����I�r�"�&�&�':�B�?�C�C�J�O�
���	��K�&.�^�^�%5��!�s�E���9K��U�
����s�
A#�A#)�azure�ec2�platformc���tj|�}|sy||�}|j�D],\}}|s�	|||j�|j�z<�.y)z�Add datasoure specific information from the ds dictionary.

    ds_data contains the "ds" entry from data from
    /run/cloud/instance-data.json.
    N)�PLATFORM_SPECIFIC_INFOrRrk�
capitalize)r,r�rl�
platform_info�retrieved_datar{r|s       r0�add_datasource_specific_infor��sg��+�.�.�x�8�M���"�7�+�N�$�*�*�,�A�
��U���;@��x�"�"�$�s�~�~�'7�7�8�Ar2c�8�	t�sytdd�5}tj|�}ddd�jd�}|s<tj�jdt|j���yddd	d
ddd
�j�D]\}}|j|�}|s�|||<� t||d|jd��y#1swY��xYw#t$r&tj�jd�YywxYw)z�Entry point for Apport.

    This hook runs for every apport report

    Add a subset of non-sensitive cloud-init data from
    /run/cloud/instance-data.json that will be helpful for debugging.
    Nz"/run/cloud-init/instance-data.json�rzKcloud-init run data not found on system. Unable to add cloud-specific data.�v1z8instance-data.json lacks 'v1' metadata. Present keys: %s�CloudID�	CloudName�CloudArchitecture�
CloudPlatform�CloudRegion�CloudSubPlatform)�cloud_id�
cloud_name�machiner�ru�subplatformr��ds)
r�open�json�load�FileNotFoundError�logging�	getLogger�warningrR�sortedrSrkr�)r,�_�fopen�
instance_datar�r{�
report_keyr|s        r0�general_add_infor��s"��
�$�&��
�6��
<�	-�� �I�I�e�,�M�	-�
�	�	�4�	 �B�
�����#�#�F��=�%�%�'�(�	
�	��!�&�#��)�
��e�g�
'���Z����s����!&�F�:��
'�!���:��
� 1� 1�$� 7��;	-�	-��������#�#�
1�	
�	��s,�
C*�C*�C�C*�C'�#C*�*,D�D)NF)N)rFN)!�__doc__r�r�r9�typingr�cloudinit.cmd.devel.logsrr�cloudinit.cmd.statusr�apport.hookutilsrrr	r
rY�ImportError�KNOWN_CLOUD_NAMESr1r7r>rE�boolrJrWr[�strrqr}r�r�r��r2r0�<module>r�s���
"���	���7�
����J�
'��T@�,B�G�"'��T��$-�(�(��S�#�X���"�d�3��8�n��$$3�=�I��
A�3�
A�D�
A� *��w���J��s�A;�;B�B

https://t.me/RX1948 - 2025