a >h @s6ddlmZddlmZmZmZGdddeeZdS))glob)Plugin RedHatPlugin PluginOptc@s<eZdZdZdZdZdZeddddgZd d Z d d Z d S)WatchdogzWatchdog information.watchdog)system)r conf-filez/etc/watchdog.confzwatchdog config file)defaultZdescc Csd}t|dddh}|D]R}|dd}z(|dd\}}|d krT|}WqtyhYq0qWdn1s0Y|S) aGet 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. NrzUTF-8)encoding#r=zlog-dir)opensplitstrip ValueError)self conf_filelog_dirZconf_flinekeyvaluer?/usr/lib/python3.9/site-packages/sos/report/plugins/watchdog.py get_log_dirs    &zWatchdog.get_log_dirc Cs||d}|d}||dg|ddgz||}|rJ|}Wn:ty}z"|d|d|WYd}~n d}~00|d rt||d }n t||d t||d }||t|d D]}|d|qdS)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/scriptszCould not read z: NZall_logs*z*.stdoutz*.stderrz/dev/watchdog*zwdctl )Z path_joinZ get_optionZ add_copy_specrIOErrorZ _log_warnrZadd_cmd_output)rrrresexZ log_filesdevrrrsetup4s0  ,  zWatchdog.setupN) __name__ __module__ __qualname__Z short_descZ plugin_nameZprofilesZpackagesrZ option_listrr"rrrrrsrN)rZsos.report.pluginsrrrrrrrr s