
    ~ g                     0    S SK JrJrJr   " S S\\5      rg)    )PluginIndependentPlugin	PluginOptc                   R    \ rS rSrSrSrSrSrSr\4r	\
" SSS	S
9/rS rS rS rSrg)SHMcli   zshmcli 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QnU H%  nU R                  U R                   SU 3SU 3S9  M'     U R                  5         U R                  5         g )N)zlist adapterszlist physical enclosureszlist failed drives shmcli_suggest_filename)add_cmd_output
shmcli_bincollect_enclosures_listcollect_drivers_list)selfsubcmdssubcmds      ;/usr/lib/python3/dist-packages/sos/report/plugins/shmcli.pysetupSHMcli.setup    s_    
 F??#1VH-#*6(!3   5 
 	$$&!!#    c           	        ^ / nU R                  S5      nUS   S:X  av  US   R                  5        H_  mTR                  5       n[        U5      S:  d  M$  US   R	                  5       S:X  d  M=  UR                  TR                  5       S   5        Ma     [        [        U5      5      n/ SQnU R                  U R                   S	3S
S9nUS   S:X  Ga  US   R                  5       SS  H  mTR                  5       m[        U4S jU 5       5      (       d  M/  TS   nTS   nU HE  nU R                   SU SU SU 3nUR                  U R                  S5      n	U R                  XS9  MG     U R                  S5      (       d  M  U R                  SS9n
U R                   SU SU 3nUR                  U R                  S5      nSU
 3nU R                  X-   USS9  M     gg)zCollect info on the enclosures z	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 list enclosuresshmcli_list_enclosuresr   c              3   ,   >#    U  H	  oT;   v   M     g 7f)N ).0mlines     r   	<genexpr>1SHMcli.collect_enclosures_list.<locals>.<genexpr>Q   s     1&QDy&s   r   z -a=z -enc=r	   r   F)makez getdebugcli -a=z -outputdir=i,  )r   timeoutN)exec_cmd
splitlinessplitlenupperappendlistsetcollect_cmd_outputr   anyreplacer   
get_optionget_cmd_output_path)r   modelsresultwordsr   adapt_index	enc_indexr   _cmd_fnamelogpath_dcmd_dname_odirr,   s                 @r   r   SHMcli.collect_enclosures_list0   s    {+(q x(335

JNuQx~~'76'AMM$**,q/2 6 c&k"
 ((/05 ) 
 (q x(335a;zz|1&111"&r(K $QI")#'??"31VHD"(!5!%doox!H++D+J	 #*
 w//"&":":":"F$(OO#4 5''2m6)"F!&t!I".wi 8++!MF$' , ! < !r   c                 \   U R                  U R                   S3SS9nUS   S:X  a  US   R                  5        Hn  nUR                  5       n[	        U5      S:  d  M$  US   S;  d  M/  U R                   S	US    3nUR                  U R                  S
5      nU R                  XES9  Mp     gg)zCollect info on the drives z list drivesshmcli_list_drivesr   r!   r   r"      )WWNz---z info drive -d=r	   N)r:   r   r3   r4   r5   r<   r   )r   r@   r,   rA   rD   rE   s         r   r   SHMcli.collect_drivers_listd   s    ((|,1 ) 
 (q x(335

u:>a6"&//!2/%(L!%doox!H++D+J 6 !r   r)   N)__name__
__module____qualname____firstlineno____doc__
short_descplugin_nameprofilesr   filesr   option_listr   r   r   __static_attributes__r)   r   r   r   r      sM     0JK1H7JME 	'5/KLK$ 2hKr   r   N)sos.report.pluginsr   r   r   r   r)   r   r   <module>r\      s!    D CeKV& eKr   