관리-도구
편집 파일: proxmox.cpython-39.opt-1.pyc
a ����-�_g�����������������������@���s2���d�dl�Z�d�dlmZmZmZ�G�dd��dee�ZdS�)�����N)�Plugin�DebianPlugin� PluginOptc�������������������@���s<���e�Zd�ZdZdZdZdZedddd�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�defaultc��������������������sR���|���d��d���g�d�}g�}|D�]}|�|��|���q |����fdd�|D����d�S�)Nr����:)zcluster/resourceszcluster/config/nodeszcluster/optionsznodes/:id/statusznodes/:id/storageznodes/:id/networkZpoolsZstoragezstorage/:sidzcluster/ceph/statuszcluster/ceph/metadatazcluster/ceph/flagsc�������������� ������s8���g�|�]0}��D�]&}d�|��d|dkr$dnd��d|����qqS�)z pvesh get � r���z --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���r���r����setup$���s�����z Proxmox.setupc����������� ��� ���C���s����|��d�}g�}tdd��t|�D��d�}|dur�d�|d|���}d�||d�d���}|��d|��d��}|d�d 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 �/c�����������������s���s ���|�]\}}|��d��r|V��qdS�)r ���N)� startswith)r ����i�partr���r���r���� <genexpr>O���s��� �z*Proxmox.build_cmd_paths.<locals>.<genexpr>N����z pvesh ls z --output-format json�statusr����output�name) r����next� enumerate�joinZexec_cmd�json�loadsr���r����append) r���� base_path�parts�pathsZid_index�pathZ trailing_path�resultsZchildren�childr���r���r���r���B���s&���� ���zProxmox.build_cmd_pathsN)�__name__� __module__�__qualname__�__doc__Z short_descZplugin_nameZpackagesr���Zoption_listr���r���r���r���r���r���r������s�����r���)r$���Zsos.report.pluginsr���r���r���r���r���r���r���r����<module> ���s���