o
    id
                     @   s2   d dl mZmZmZ d dlZG dd deeZdS )    )PluginIndependentPlugin	PluginOptNc                   @   s@   e Zd ZdZdZdZdZdZedddd	gZ	d
d Z
dd ZdS )HpssmaG  
    This plugin will capture details for each controller from Smart Storage
    Array Administrator, an Array diagnostic report from Smart Storage
    Administrator Diagnostics Utility and, when the plugins debug option is
    enabled will gather the Active Health System log via the RESTful Interface
    Tool (iLOREST).
    zHP Smart Storage Managementhpssm)systemstoragehardware)ilorestssaclissaduclidebugFzcapture debug data)defaultdescc                    s   d dg}g d|   fdd|D  td d }| |}g }|d d	kr8fd
d|d  D } d |  fdd|D  |  }| j d| dd | drb| | d S d S )Nr   zctrl all show status)zarray all show detailzld all showzld all show detailzpd all showzpd all show detailzshow detailc                    s   g | ]}d  |f qS )z%s %s ).0subcmd)cmdr   :/usr/lib/python3/dist-packages/sos/report/plugins/hpssm.py
<listcomp>-   s    zHpssm.setup.<locals>.<listcomp>z,^HP.*Smart Array (.*) in Slot ([0123456789])z ctrl all show config detailstatusr   c                    s$   g | ]}  |}|r|d qS )   )searchgroup)r   linem)patternr   r   r   5   s    outputz ctrl slot=c                    s$   g | ]} D ]	}d ||f qqS )z%s%s %sr   )r   slotslot_subcmd)slot_subcmdsssacli_ctrl_slot_cmdr   r   r   :   s    z"ssaducli -v -adu -f %s/adu-log.zipzssaducli_-v_-adu.log)suggest_filenamer   )add_cmd_outputrecompilecollect_cmd_output
splitlinesget_cmd_output_path
get_optiondo_debug)selfsubcmdsconfig_detail_cmdconfig_detail
ctrl_slotslogpathr   )r   r   r    r!   r   setup   s:   





zHpssm.setupc                 C   s   | j d| |dd d S )Nz5ilorest serverlogs --selectlog=AHS --directorypath=%szilorest.log)runatr"   )r#   )r+   r0   r   r   r   r*   M   s   
zHpssm.do_debugN)__name__
__module____qualname____doc__
short_descplugin_nameprofilespackagesr   option_listr1   r*   r   r   r   r   r      s    .r   )sos.report.pluginsr   r   r   r$   r   r   r   r   r   <module>   s   