Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
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-310.pyc
o

}��f�'�@s@dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlmZzddl
mZmZmZmZdZWneyCd	ZYnwgd
�Zdefdd
�Zd(dd�Zd(dd�Zd(dd�Zd(dd�Zd(dd�Zd(dd�Zdd�Zdd�Zdeeeffdd�Zdeeeffd d!�Z ee d"�Z!d#eddfd$d%�Z"d)d&d'�Z#dS)*zCloud-init apport interface�N)�Dict)�read_cfg_paths)�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�
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)�OpenTelekomCloudzSAP Converged Cloud�Scaleway�SmartOS�UpCloud�VMware�Vultr�ZStack�Outscale�WSL�Other�returncCst�}|�d�S)N�userdata_raw)r�
get_ipath_cur)�paths�r,�2/usr/lib/python3/dist-packages/cloudinit/apport.py�_get_user_data_fileHs
r.cCs,t|ddd��tgd��t|dd�dS)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.txt)z
cloud-initzcollect-logsz-t�/tmp/cloud-init-logs.tgzr/zlogs.tgzN)r	r
r��report�uir,r,r-�attach_cloud_init_logsMs��	��r3cCs,d}|r|�|�rt|ddi�dSdSdS)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	)r1r2�promptr,r,r-�
attach_hwinfo`s
��r7c
Cs�|rit�}z,t|�d���}t�|�}|�di��d�sJ�	Wd�WdS1s+wYWnttjjt	fy?Ynwd}|�
|�}|durMt�|rkd}|�|t
�}|rct
|d|d<dSd	|d<dSdSdS)
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_data�v1�
cloud_nameNz/Is this machine running in a cloud environment?zOPlease select the cloud vendor or environment in which this instance is runningr�	CloudName�None)r�open�get_runpath�json�load�get�IOError�decoder�JSONDecodeError�AssertionErrorr5�
StopIteration�choice�KNOWN_CLOUD_NAMES)r1r2r+�filer8r6�responser,r,r-�attach_cloud_infoks0

&��
��rKcCs*tD]}tj�|j�}t|||j�qdS)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)r1r2�apport_filerNr,r,r-�attach_installer_files�s�rQcCs^tj�d�}t||�tj�|�r-|�dd�|dr#|dd7<|dd7<dSdS)z<Attach ubuntu pro logs and tag if keys present in user-data.z/var/log/ubuntu-advantage.log�Tags�� z
ubuntu-proN)rLrMrNr�exists�
setdefault)r1r2rNr,r,r-�attach_ubuntu_pro_info�s
�rWcCsx|r6t�}d�|�}|�|�}|durt�|r8tj�|�}t||d�tD]}tj�|j�}t	|||j
�q%dSdSdS)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.�formatr5rFrLrMrNrrrrO)r1r2�user_data_filer6rJrNrPr,r,r-�attach_user_data�s&�
��rZcCs�g}|�d�r|�d�|�d�r|�d�d|��vr)|d}d|vr)|�d�|�d�r3|�d	�|rT|�d
d�|d
rG|d
d7<|d
d�|�7<d
Sd
S)z$Add any appropriate tags to the bug.�CurtinError�curtin�SubiquityLog�	subiquity�
JournalErrorszBreaking ordering cyclezsystemd-ordering�UdiLogzubuntu-desktop-installerrRrSrTN)rA�append�keysrV�join)r1�new_tags�errorsr,r,r-�add_bug_tags�s"






�rfcCsTtstd��t||�t||�t||�t||�t||�t||�t|�dS)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�RuntimeErrorr3r7rKrZrQrWrfr0r,r,r-�add_info�s�





ricCsX|�di��di��d�}|siSdddddd	�}i}|��D]
\}}||||<q|S)
N�	meta_data�imds�compute�ImagePublisher�
ImageOffer�ImageSKU�ImageVersion�VMSize)�	publisher�offer�sku�version�vmSize�rA�items)�ds_datarl�name_to_report_map�
azure_data�src_key�report_key_namer,r,r-�_get_azure_data�s�r~cs@|�di��di��d�}|siShd���fdd�|��D�S)N�dynamiczinstance-identity�document>�region�imageId�architecture�instanceType�billingProductscsi|]\}}|�vr||�qSr,r,)�.0�key�value��wanted_keysr,r-�
<dictcomp>	sz!_get_ec2_data.<locals>.<dictcomp>rw)ryr�r,r�r-�
_get_ec2_data�s�
�r�)�azure�ec2�platformcCsJt�|�}|s	dS||�}|��D]\}}|sq|||��|��<qdS)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_INFOrArx�
capitalize)r1r�ry�
platform_info�retrieved_datar�r�r,r,r-�add_datasource_specific_infos
�r�cCs�z"t�sWdStdd��
}t�|�}Wd�n1swYWnty3t���d�YdSw|�d�}|sIt���dt	|�
���dSddd	d
ddd
���D]\}}|�|�}|rc|||<qTt||d|�d��dS)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.r9z8instance-data.json lacks 'v1' metadata. Present keys: %s�CloudIDr;�CloudArchitecture�
CloudPlatform�CloudRegion�CloudSubPlatform)�cloud_idr:�machiner�r��subplatformr��ds)
rr=r?r@�FileNotFoundError�logging�	getLogger�warningrA�sortedrbrxr�)r1�_�fopenr8r9r��
report_keyr�r,r,r-�general_add_info!sH����

��
�
��r�)N)r(N)$�__doc__r?r�rL�typingr�cloudinit.cmd.develr�cloudinit.cmd.devel.logsrr�cloudinit.cmd.statusr�apport.hookutilsrrr	r
rg�ImportErrorrH�strr.r3r7rKrQrWrZrfrir~r�r�r�r�r,r,r,r-�<module>s:�(



(




Spamworldpro Mini