...
———————syslog_config.py——————
To add the functionality on which logs to check in log_match(), syslog or local logs we will follow this table -
PBS_SYSLOG and PBS_LOCALLOG are values from the pbs.conf file. Syslog_attribute is the attribute to be passed to the log_match() function. Return value is the return value of log_match()
| |||||||||||||||||||||||||||||||||||||||||||||||||
|
In row 7 where we have to match in both syslog and local log, we would have to call _log_match() twice.
import platform
class syslog_configutils(object):
def _init_(self):
...
self.syslog_conf_path = {'centos7': '/etc/rsyslog’rsyslog.conf', 'RHEL7': '/etc/rsyslog'}
...
// Read the path of the syslog messages file
// returns the path file as a string
return path_to_messages
...
// Getting the date format logged in the syslog file
// returns the time_format as string
return time_format
def log_config_values(syslog=0)
// logic for which file to read will come from the above table
// returns a integer value which is interpreted as which file to check
file_to_check=0
// read from PBS.conf PBS_SYSLOG & PBS_LOCALLOG
...
————pbs_testlib.py——————————
...
PBS_SYSLOG and PBS_LOCALLOG are values from the pbs.conf file. Syslog_attribute is the attribute to be passed to the log_match() function. Return value is the return value of log_match()
...
PBS_SYSLOG
...
PBS_LOCALLOG
...
Syslog_attribute
...
Which log to check in log_match()
...
Not_set
...
0
...
0
...
Throw error
...
Not_set
...
0
...
1
...
Throw error
...
Not_set
...
1
...
0
...
Local_Log
...
Not_set
...
1
...
1
...
Throw error
...
set
...
0
...
0
...
Syslog
...
set
...
0
...
1
...
Syslog
...
set
...
1
...
0
...
Match in both logs
...
set
...
1
...
1
...
Syslog
...
...
In row 7 where we have to match in both syslog and local log, we would have to call _log_match() twice.
Following changes are done to the current log_match() function
...
class PBSService(PBSObject)
def _init(self)
def log_match(syslog=1)
if syslog=1
...
tm_re = syslog_config.time_syslog()
fmt=format_of_date_time def convert_date_time(fmt)
if syslog_value = 1
self.fmt= //get format from syslog_config.time_syslog()
...