Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chkcrontab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Lyda
chkcrontab
Commits
4d96a867
Commit
4d96a867
authored
Jun 18, 2012
by
Kevin Lyda
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://code.google.com/p/chkcrontab
parents
f03e5a02
f6a5f063
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.pylintrc
+2
-2
2 additions, 2 deletions
.pylintrc
chkcrontab_lib.py
+11
-5
11 additions, 5 deletions
chkcrontab_lib.py
tests/test_check.py
+2
-2
2 additions, 2 deletions
tests/test_check.py
with
15 additions
and
9 deletions
.pylintrc
+
2
−
2
View file @
4d96a867
...
@@ -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=
...
...
This diff is collapsed.
Click to expand it.
chkcrontab_lib.py
+
11
−
5
View file @
4d96a867
...
@@ -342,22 +342,22 @@ class CronTimeField(object):
...
@@ -342,22 +342,22 @@ class CronTimeField(object):
return
self
.
_text
return
self
.
_text
@property
@property
def
k
ind
(
self
):
def
K
ind
(
self
):
"""
Kind field.
"""
"""
Kind field.
"""
return
self
.
_kind
return
self
.
_kind
@property
@property
def
s
tart
(
self
):
def
S
tart
(
self
):
"""
Start value of this field.
"""
"""
Start value of this field.
"""
return
self
.
_start
return
self
.
_start
@property
@property
def
e
nd
(
self
):
def
E
nd
(
self
):
"""
End value of this field.
"""
"""
End value of this field.
"""
return
self
.
_end
return
self
.
_end
@property
@property
def
s
tep
(
self
):
def
S
tep
(
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
].
k
ind
==
'
star
'
:
if
len
(
cron_time_field
)
==
1
and
cron_time_field
[
0
].
K
ind
==
'
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.
'
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_check.py
+
2
−
2
View file @
4d96a867
...
@@ -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
].
k
ind
,
self
.
assertEquals
(
parsed_fields
[
'
cron_times
'
][
i
].
K
ind
,
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
].
k
ind
,
%
(
parsed_fields
[
'
cron_times
'
][
i
].
K
ind
,
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
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment