
    ~ g                     ,    S SK JrJr   " S S\\5      rg)    )PluginRedHatPluginc                   6    \ rS rSrSrSrSrSrS rS r	S r
S	rg
)Sapnw   zSAP NetWeaversapnw)sap)z/usr/sapc                   ^ U R                  SSS9nUS   S:w  a  g[        5       nUS   R                  5        GHt  nSU;  d  M  UR                  S	5      (       a  M$  UR	                  5       R                  5       n[        U5      S
:  a  MS  US   nUS   nUS   nUR                  U5        SU S3nU R                  U5      (       d  M  U R                  U5       H  m[        U4S jXVU4 5       5      (       d  M!  SU S3n	SU S3nTR	                  5       n
U R                  SU	 SU SU SU
 3U
 S3S9  U R                  SU	 SU SU S3U SU S3S9  U R                  SU	 SU SU S3U SU S3S9  UR                  5       nU SU SU S3nU R                  S U S!U S"3US9  M     GMw     U H  nU R                  SU S#35        M     g)$z$Collect data on installed instances z9/usr/sap/hostctrl/exe/saphostctrl -function ListInstancesSAPInstancessuggest_filenamestatusr   NoutputDAAzNo instances found            z	/usr/sap/z/SYS/profile/c              3   ,   >#    U  H	  oT;   v   M     g 7fN ).0flines     :/usr/lib/python3/dist-packages/sos/report/plugins/sapnw.py	<genexpr>/Sapnw.collect_list_instances.<locals>.<genexpr>-   s     A.@9.@s   zLD_LIBRARY_PATH=/usr/sap/z/SYS/exe/runz/SYS/exe/uc/linuxx86_64zenv -i  z/sappfpar all pf=/usr/sap/_parametersz/sapcontrol -nr z -function GetProcessList__GetProcListz -function GetVersionInfo_GetVersInfoadm__userenvsu - zadm -c "sapcontrol -nr z -function GetEnvironment"z/*DVEB*/work/dev_w0)collect_cmd_outputset
splitlines
startswithstripsplitlenaddpath_existslistdiralladd_cmd_outputloweradd_copy_spec)self	inst_list
sidsunique	inst_linefieldssidinstvhostpathldenvprofilelowsidfnamer   s                @r   collect_list_instancesSapnw.collect_list_instances   sn   ++G+ , 
	 X!#U
 #8,779IY&(()=>>"*002v;?Qiayq	s#"3%}5''-- LL.DAs%.@AAA";C5 M "+3%/FG"&**, ++%eWAdV 4++.%}WIG07y-D ,  ++%eWAdV3CD6 J7 703uAdV<-H ,  ++%eWAdV3CD6 J7 703uAdV<-H ,  "%#&%qTF( C++#F8+B4& I8 8-2 , A / :h C3%/BCD     c                 ,   U R                  SSS9nUS   S:w  a  gUS   R                  5        H  nSU;   d  M  UR                  5       R                  5       nUS	   SS
 nUS   SS
 nUSS R	                  5       nUS:X  a  U R                  SU S3U SU S3S9  Mn  US:X  a"  US	   SS
 nU R                  SU SU S35        M  US:X  a  US	   SS
 nU R                  SU S35        M  US:X  d  M  US	   SS
 nU R                  SU SU S35        M     g)z#Collect data all the installed DBs z9/usr/sap/hostctrl/exe/saphostctrl -function ListDatabasesSAPDatabasesr   r   r   Nr   zInstance name   r   r   db6r%   z -c "db2 get dbm cfg"r    	_db2_infor	   z/sapdb/z/data/config/z.pahoraz/oracle/z/*/dbs/init.orasybz/sybase/z/ASE*/z.cfg)r&   r(   r*   r+   upperr1   r3   )r4   db_listr   r8   dbadmdbtyper9   s          r   collect_list_dbsSapnw.collect_list_dbsV   sf    ))G+ * 

 8!H%002D$&++-q	#23BABioo'U?''w&=>,/5%	)B ( 
 u_ )CR.C&&!#mC5= u_ )CR.C&&#o'FGu_ )CR.C&&#fSE'FG; 3rC   c                 D    U R                  5         U R                  5         g r   )rA   rP   )r4   s    r   setupSapnw.setup   s    ##%rC   r   N)__name__
__module____qualname____firstlineno__
short_descplugin_nameprofilesfilesrA   rP   rS   __static_attributes__r   rC   r   r   r      s*     JKHEAEF(HT rC   r   N)sos.report.pluginsr   r   r   r   rC   r   <module>r_      s    4v FL v rC   