| Server IP : 77.50.203.18 / Your IP : 192.168.0.10 Web Server : Apache/2.4.62 (CentOS Stream) OpenSSL/3.5.7 mpm-itk/2.4.7-04 PHP/8.4.23 System : Linux web2 5.14.0-722.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 6 09:07:51 UTC 2026 x86_64 User : warsnews.ru ( 1001) PHP Version : 8.4.23 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.9/site-packages/sos/report/plugins/__pycache__/ |
Upload File : |
a
ܓ�i6 � @ sV d dl Z d dlmZ d dlmZ d dlmZ d dlmZm Z m
Z
G dd� dee �ZdS )� N)�Any)�request)�URLError)�Plugin�IndependentPlugin� PluginOptc @ s� e Zd ZdZdZdZedddd�gZdZd Z d
Z
dZdd
� Zdd� Z
dd� Zed�dd�Zeed�dd�Zdd� Zeeed�dd��ZdS )�GCPzGoogle Cloud Platform�gcp)Zvirt�keep-piiFzyStop the plugin from removing PIIs like project name or organization ID from the metadata retrieved from Metadata server.)�defaultZdescz(/sys/devices/virtual/dmi/id/product_namezBhttp://metadata.google.internal/computeMetadata/v1/?recursive=truez[--REDACTED--]Nc C sZ z@t | jdd��}d|�� v W d � W S 1 s40 Y W n tyT Y dS 0 dS )zo
Checks if this plugin should be executed based on the presence of
GCE entry in sysfs.
zutf-8)�encodingzGoogle Compute EngineNF)�open�PRODUCT_PATH�read�OSError)�selfZsys_file� r �:/usr/lib/python3.9/site-packages/sos/report/plugins/gcp.py�
check_enabled$ s
0zGCP.check_enabledc C s$ | j ddgd� | jddgd� dS )z�
Collect the following info:
* `gcloud auth list` output
* Any google services output from journal
zgcloud auth listr ��tagszgoogle*)Zunitsr N)Zadd_cmd_outputZadd_journal�r r r r �setup/ s z GCP.setupc C s� | j ddgd��p}z,| �� | _| �� |�tj| jdd�� W n2 typ } z|�t|�� W Y d }~n
d }~0 0 W d � n1 s�0 Y d}| j j
�d�}|r�| �|� d S )Nz
metadata.jsonr r � )�indentzAcurl -v --connect-timeout 10https://rhui.googlecloud.com/zone.txtzgoogle-rhui-client)
Zcollection_file�get_metadata�metadata�scrub_metadata�write�json�dumps�RuntimeError�strZpolicyZpackage_managerZall_pkgs_by_name_regexZcollect_cmd_output)r Zmfile�errZcurl_commandZrhui_packager r r �collect<