Skip to content
Snippets Groups Projects
Commit 4d96a867 authored by Kevin Lyda's avatar Kevin Lyda :speech_balloon:
Browse files

Merge branch 'master' of https://code.google.com/p/chkcrontab

parents f03e5a02 f6a5f063
Branches
Tags
No related merge requests found
...@@ -70,11 +70,11 @@ max-branchs=12 ...@@ -70,11 +70,11 @@ max-branchs=12
max-statements=50 max-statements=50
max-parents=7 max-parents=7
max-attributes=7 max-attributes=7
min-public-methods=2 min-public-methods=1
max-public-methods=20 max-public-methods=20
[IMPORTS] [IMPORTS]
deprecated-modules=regsub,string,TERMIOS,Bastion,rexec deprecated-modules=regsub,TERMIOS,Bastion,rexec
import-graph= import-graph=
ext-import-graph= ext-import-graph=
int-import-graph= int-import-graph=
......
...@@ -342,22 +342,22 @@ class CronTimeField(object): ...@@ -342,22 +342,22 @@ class CronTimeField(object):
return self._text return self._text
@property @property
def kind(self): def Kind(self):
"""Kind field.""" """Kind field."""
return self._kind return self._kind
@property @property
def start(self): def Start(self):
"""Start value of this field.""" """Start value of this field."""
return self._start return self._start
@property @property
def end(self): def End(self):
"""End value of this field.""" """End value of this field."""
return self._end return self._end
@property @property
def step(self): def Step(self):
"""Step for this field.""" """Step for this field."""
return self._step return self._step
...@@ -488,7 +488,7 @@ def ChkCTStarOnly(cron_time_field): ...@@ -488,7 +488,7 @@ def ChkCTStarOnly(cron_time_field):
""" """
if not cron_time_field: if not cron_time_field:
return True return True
if len(cron_time_field) == 1 and cron_time_field[0].kind == 'star': if len(cron_time_field) == 1 and cron_time_field[0].Kind == 'star':
return True return True
return False return False
...@@ -693,6 +693,7 @@ class CronLineTimeAction(object): ...@@ -693,6 +693,7 @@ class CronLineTimeAction(object):
self.command = command self.command = command
def _CheckTimeField(self, log): def _CheckTimeField(self, log):
"""Virtual method to be implemented by subclasses to check time field."""
pass pass
def ValidateAndLog(self, log): def ValidateAndLog(self, log):
...@@ -782,6 +783,11 @@ class CronLineUnknown(object): ...@@ -782,6 +783,11 @@ class CronLineUnknown(object):
"""For unrecognised cron lines.""" """For unrecognised cron lines."""
def ValidateAndLog(self, log): def ValidateAndLog(self, log):
"""Emits an error for unrecognised cron lines.
Args:
log: A LogCounter instance to record issues.
"""
log.LineError(log.MSG_LINE_ERROR, 'Failed to parse line.') log.LineError(log.MSG_LINE_ERROR, 'Failed to parse line.')
......
...@@ -71,10 +71,10 @@ class FSMUnitTest(unittest.TestCase): ...@@ -71,10 +71,10 @@ class FSMUnitTest(unittest.TestCase):
len(parsed_fields['cron_times']))) len(parsed_fields['cron_times'])))
for i in range(min(len(parsed_fields['cron_times']), for i in range(min(len(parsed_fields['cron_times']),
len(check_parsed_fields['cron_times']))): len(check_parsed_fields['cron_times']))):
self.assertEquals(parsed_fields['cron_times'][i].kind, self.assertEquals(parsed_fields['cron_times'][i].Kind,
check_parsed_fields['cron_times'][i][0], check_parsed_fields['cron_times'][i][0],
'Parser detected "%s" field not "%s"' 'Parser detected "%s" field not "%s"'
% (parsed_fields['cron_times'][i].kind, % (parsed_fields['cron_times'][i].Kind,
check_parsed_fields['cron_times'][i][0])) check_parsed_fields['cron_times'][i][0]))
self.assertEquals('%s' % parsed_fields['cron_times'][i], self.assertEquals('%s' % parsed_fields['cron_times'][i],
check_parsed_fields['cron_times'][i][1], check_parsed_fields['cron_times'][i][1],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment