U
    id                     @   s*   d dl mZmZmZ G dd deeZdS )    )PluginIndependentPlugin	PluginOptc                   @   s>   e Zd ZdZdZdZdZdZefZe	dddd	gZ
d
d ZdS )SHMclia  shmcli pulls hardware information from PowerVault/Dell
    Storage JBOD's attached to server.
    It provides information of the adapters, emms, drives,
    enclosures, fans, power supplies and the sensory data of
    temp, voltage, and current sensors.
    zDell Server Hardware Managershmcli)systemZstorageZhardwarezC/opt/dell/ServerHardwareManager/ServerHardwareManagerCLI/bin/shmclidebugFzcapture support debug data)defaultZdescc              
      s*  | j }dddg}|D ]}| jd||f d| d qg }| d}|d d	kr|d
  D ]:}| }t|dkrZ|d  dkrZ|| d  qZtt	|}ddddddddddg
}| j
d| dd}|d d	kr|d
  dd D ]}|  t fdd|D r d } d	 }	|D ]0}d||||	f }
|
|d}| j|
|d q$| d r| jd!d"}d#|||	f }||d}d$| }| j|| |d%d& q| j
d'| d(d}|d d	kr&|d
  D ]T}| }t|d)kr|d	 d*krd+||d	 f }
|
|d}| j|
|d qd S ),Nzlist adapterszlist physical enclosureszlist failed drivesz%s %sz	shmcli_%s)suggest_filenamez	lsscsi -gZstatusr   output   ZDELL   z	list emmszlist drawerszlist emm slotszlist drive slotsz	list fanszlist temp sensorszlist voltage sensorszlist current sensorszlist power supplieszinfo enclosurez%s list enclosuresZshmcli_list_enclosuresc                 3   s   | ]}| kV  qd S )N ).0m_liner   ;/usr/lib/python3/dist-packages/sos/report/plugins/shmcli.py	<genexpr>M   s     zSHMcli.setup.<locals>.<genexpr>z%s %s -a=%s -enc=%sr   r   F)Zmakez%s getdebugcli -a=%s -enc=%sz -outputdir=%si,  )r
   Ztimeoutz%s list drivesZshmcli_list_drives   )ZWWNz---z%s info drive -d=%s)
shmcli_binZadd_cmd_outputZexec_cmd
splitlinessplitlenupperappendlistsetZcollect_cmd_outputanyreplaceZ
get_optionZget_cmd_output_path)selfcmdZsubcmdsZsubcmdZmodelsresultlineZwordsZadapt_indexZ	enc_indexZ_cmdZ_fnameZlogpathZ_dcmdZ_dnameZ_odirr   r   r   setup    s    



 
zSHMcli.setupN)__name__
__module____qualname____doc__Z
short_descZplugin_nameZprofilesr   filesr   Zoption_listr&   r   r   r   r   r      s   r   N)Zsos.report.pluginsr   r   r   r   r   r   r   r   <module>	   s   