U
    -_g
                     @   s&   d dl mZmZ G dd deeZdS )    )PluginRedHatPluginc                   @   s,   e Zd ZdZdZdZdZdd Zdd Zd	S )
SaphanazSAP HANAZsaphana)Zsap)z/hanac                 C   s"  g }|  dr| d}|D ]"}t|dkr| }|| q|D ]}|  d}d| d}| j| d| dd | j| d	| d
d | j| d| dd | j| d| dd |  d| drF| d| dD ]*}d|kr| dd  }| ||| qqFd S )Nz/hana/shared   Zadmzsu - z -cz "HDB info"Z	_HDB_infoZsuggest_filenamez "hdbsrvutil -v"Z_versionz 'hdbcons "mm l -s -S -p"'Z	_memusagezS 'hdbcons -e hdbindexserver                                     "replication info"'Z_replicainfoz/hana/shared//ZHDB)
path_isdirlistdirlenstripappendloweradd_cmd_outputget_inst_info)selfZsidsZsharedsidsidadmprefixinst r   </usr/lib/python3/dist-packages/sos/report/plugins/saphana.pysetup   s6    
zSaphana.setupc           	      C   st   d}| d| d}| j |||f |d d| d| d}| |rpd}| d| d	}| j |||f |d d
S )z! Collect the given instance info z7su - %s -c "sapcontrol -nr %s -function GetProcessList"_Z_statusr   z	/usr/sap/z/HDBz/exe/python_supportz4su - %s -c "python %s/landscapeHostConfiguration.py"Z_landscapeConfigN)r   r	   )	r   r   r   r   Zproc_cmdZstatus_fnamepathZpy_cmdZpy_fnamer   r   r   r   5   s    


zSaphana.get_inst_infoN)	__name__
__module____qualname__Z
short_descZplugin_nameZprofilesfilesr   r   r   r   r   r   r      s   "r   N)Zsos.report.pluginsr   r   r   r   r   r   r   <module>	   s   