o
    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)systemstoragehardwarezC/opt/dell/ServerHardwareManager/ServerHardwareManagerCLI/bin/shmclidebugFzcapture support debug data)defaultdescc                    s  | j }g d}|D ]}| jd||f d| d q	g }| d}|d dkrJ|d  D ]}| }t|d	krI|d	  d
krI|| d  q,tt	|}g d}| j
d| dd}|d dkr|d  d	d D ]Y}|  t fdd|D rƈ d } d }	|D ]}d||||	f }
|
|d}| j|
|d q| dr| jdd}d|||	f }||d}d| }| j|| |dd qm| j
d| dd}|d dkr|d  D ]+}| }t|dkr|d dvrd ||d f }
|
|d}| j|
|d qd S d S )!N)zlist adapterszlist physical enclosureszlist failed drivesz%s %sz	shmcli_%s)suggest_filenamez	lsscsi -gstatusr   output   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 enclosuresshmcli_list_enclosuresc                 3   s    | ]}| v 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)makez%s getdebugcli -a=%s -enc=%sz -outputdir=%si,  )r   timeoutz%s list drivesshmcli_list_drives   )WWNz---z%s info drive -d=%s)
shmcli_binadd_cmd_outputexec_cmd
splitlinessplitlenupperappendlistsetcollect_cmd_outputanyreplace
get_optionget_cmd_output_path)selfcmdsubcmdssubcmdmodelsresultlinewordsadapt_index	enc_index_cmd_fnamelogpath_dcmd_dname_odirr   r   r   setup    s|   




zSHMcli.setupN)__name__
__module____qualname____doc__
short_descplugin_nameprofilesr"   filesr   option_listrA   r   r   r   r   r      s    r   N)sos.report.pluginsr   r   r   r   r   r   r   r   <module>   s   