
    ~ g                     <    S SK J r   S SKJrJrJr   " S S\\5      rg)    )glob)PluginRedHatPlugin	PluginOptc                   B    \ rS rSrSrSrSrSr\" SSSS	9/r	S
 r
S rSrg)Watchdog   zWatchdog information.watchdog)system)r
   	conf-filez/etc/watchdog.confzwatchdog config file)defaultdescc                 D   Sn[        USSS9 nU H`  nUR                  S5      S   R                  5       n UR                  SS5      u  pVUR                  5       S	:X  a  UR                  5       nM`  Mb     SSS5        U$ ! [         a     M{  f = f! , (       d  f       U$ = f)
zGet watchdog log directory.

Get watchdog log directory path configured in ``conf_file``.

:returns: The watchdog log directory path.
:returntype: str.
:raises: IOError if ``conf_file`` is not readable.
NrzUTF-8)encoding#r   =   zlog-dir)opensplitstrip
ValueError)self	conf_filelog_dirconf_flinekeyvalues          =/usr/lib/python3/dist-packages/sos/report/plugins/watchdog.pyget_log_dirWatchdog.get_log_dir   s     )S73vzz#q)//1#'::c1#5LSyy{i/"'++- 0  4 	 "  43 s.   (B8A?/B?
B	BBB
Bc                    U R                  U R                  S5      5      nU R                  S5      nU R                  US/5        U R                  SS/5         U R                  U5      nU(       a  UnU R                  S	5      (       a  [        U R                  US
5      5      nO7[        U R                  US5      5      [        U R                  US5      5      -   nU R                  U5        [        U R                  S5      5       H  nU R                  SU 35        M     g! [         a!  nU R                  SU SU 35         SnANSnAff = f)zCollect watchdog information.

Collect configuration files, custom executables for test-binary
and repair-binary, and stdout/stderr logs.
r   z/var/log/watchdogz/etc/sysconfig/watchdogz/etc/watchdog.dz/usr/libexec/watchdog/scriptszCould not read z: Nall_logs*z*.stdoutz*.stderrz/dev/watchdog*zwdctl )	path_join
get_optionadd_copy_specr!   IOError	_log_warnr   add_cmd_output)r   r   r   resex	log_filesdevs          r    setupWatchdog.setup4   sA    NN4??;#?@	..!45 	%
 	 	+
 		@""9-C ??:&&T^^GS9:IdnnWjABdnnWjABCI 	9% '789C&/ :  	@NN_YKr">??	@s   D# #
E-E		E N)__name__
__module____qualname____firstlineno__
short_descplugin_nameprofilespackagesr   option_listr!   r0   __static_attributes__r2       r    r   r      s9    (JKHH 	+';-	/K
2'0r=   r   N)r   sos.report.pluginsr   r   r   r   r2   r=   r    <module>r?      s      > >L0v| L0r=   