HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/sos/report/plugins/__pycache__/proxmox.cpython-39.opt-1.pyc
a

\��h��@s2ddlZddlmZmZmZGdd�dee�ZdS)�N)�Plugin�DebianPlugin�	PluginOptc@s<eZdZdZdZdZdZedddd�gZd	d
�Z	dd�Z
d
S)�Proxmoxz�
    This plugin will capture information about the system's
    Proxmox Virtualization Environment.

    It will collect information about the cluster, nodes, pools and
    storage from the Proxmox API.
    zProxmox cluster informationZproxmox)z
proxmox-ve�output-formatsz@List of output formats to use for the commands separated by ":".�text)Zdesc�defaultcsR|�d��d��gd�}g}|D]}|�|�|��q |��fdd�|D��dS)Nr�:)zcluster/resourceszcluster/config/nodeszcluster/optionsznodes/:id/statusznodes/:id/storageznodes/:id/networkZpoolsZstoragezstorage/:sidzcluster/ceph/statuszcluster/ceph/metadatazcluster/ceph/flagsc	s8g|]0}�D]&}d|�d|dkr$dnd�d|���qqS)z
pvesh get � rz
--noborder�z --output-format �)�.0�cmd�format�Zoutput_formatsr�>/usr/lib/python3.9/site-packages/sos/report/plugins/proxmox.py�
<listcomp>;s
��z!Proxmox.setup.<locals>.<listcomp>)Z
get_option�split�extend�build_cmd_pathsZadd_cmd_output)�selfZcommandsZ	cmd_pathsZcommandrrr�setup$s�z
Proxmox.setupc

Cs�|�d�}g}tdd�t|�D�d�}|dur�d�|d|��}d�||dd��}|�d|�d��}|dd	kr�t�|d
�}|D](}	|�|�|�d|	d�d|����q�n|�	d�|��|S)z�
        Build command paths,
        replacing dynamic attributes with data from the API

        :param base_path: The base path to build from
        :type base_path: str

        :return: A list of paths
        �/css |]\}}|�d�r|VqdS)r	N)�
startswith)r
�i�partrrr�	<genexpr>Os

�z*Proxmox.build_cmd_paths.<locals>.<genexpr>N�z	pvesh ls z --output-format json�statusr�output�name)
r�next�	enumerate�joinZexec_cmd�json�loadsrr�append)
r�	base_path�parts�pathsZid_index�pathZ
trailing_path�resultsZchildren�childrrrrBs&

���zProxmox.build_cmd_pathsN)�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZpackagesrZoption_listrrrrrrrs��r)r$Zsos.report.pluginsrrrrrrrr�<module>
s