
    ~ g                     8    S SK r S SKJrJrJr   " S S\\5      rg)    N)PluginDebianPlugin	PluginOptc                   B    \ rS rSrSrSrSrSr\" SSSS	9/r	S
 r
S rSrg)Proxmox   z
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.
zProxmox cluster informationproxmox)z
proxmox-veoutput-formatsz@List of output formats to use for the commands separated by ":".text)descdefaultc                 ,   U R                  S5      R                  S5      n/ SQn/ nU H#  nUR                  U R                  U5      5        M%     U R	                  U VVs/ s H   nU  H  nSU SUS:X  a  SOS S	U 3PM     M"     snn5        g s  snnf )
Nr
   :)zcluster/resourceszcluster/config/nodeszcluster/optionsznodes/:id/statusznodes/:id/storageznodes/:id/networkpoolsstoragezstorage/:sidzcluster/ceph/statuszcluster/ceph/metadatazcluster/ceph/flagsz
pvesh get  r   z
--noborder z --output-format )
get_optionsplitextendbuild_cmd_pathsadd_cmd_output)selfoutput_formatscommands	cmd_pathscommandcmdformats          </usr/lib/python3/dist-packages/sos/report/plugins/proxmox.pysetupProxmox.setup$   s    )9:@@E
 	GT11':;   	 !
 !( Qv/?|RH I%h( )( 
 	 
s    'B
c           
         UR                  S5      n/ n[        S [        U5       5       S5      nUb  SR                  USU 5      nSR                  X$S-   S 5      nU R	                  SU S35      nUS   S:X  aM  [
        R                  " US	   5      nU H.  n	UR                  U R                  U SU	S
    SU 35      5        M0     U$ UR                  SR                  U5      5        U$ )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              3   Z   #    U  H!  u  pUR                  S 5      (       d  M  Uv   M#     g7f)r   N)
startswith).0iparts      r    	<genexpr>*Proxmox.build_cmd_paths.<locals>.<genexpr>O   s'      2*:wq OOC0 *:s   +	+N   z	pvesh ls z --output-format jsonstatusr   outputname)
r   next	enumeratejoinexec_cmdjsonloadsr   r   append)
r   	base_pathpartspathsid_indexpathtrailing_pathresultschildrenchilds
             r    r   Proxmox.build_cmd_pathsB   s     $ 2)E*: 2379 88E)8,-DHHUa<=%9:Mmmiv5J$KLGx A%::gh&78%ELL,,#fAeFm_Am_E &  LL%)     N)__name__
__module____qualname____firstlineno____doc__
short_descplugin_namepackagesr   option_listr!   r   __static_attributes__rB   rA   r    r   r      s>     /JKH 	"< 	K<!rA   r   )r4   sos.report.pluginsr   r   r   r   rB   rA   r    <module>rN      s      > >Tfl TrA   