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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Lyda
chkcrontab
Commits
4bf20bf6
There was a problem fetching the pipeline summary.
Commit
4bf20bf6
authored
8 years ago
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Fix option parsing for real.
parent
e76ed418
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
chkcrontab
+6
-10
6 additions, 10 deletions
chkcrontab
with
6 additions
and
10 deletions
chkcrontab
+
6
−
10
View file @
4bf20bf6
...
...
@@ -38,29 +38,25 @@ def main(argv):
sys
.
exit
(
1
)
log
=
check
.
LogCounter
()
(
options
,
args
)
=
get_whitelisted_user
s
(
argv
)
(
options
,
args
)
=
parse_chkcrontab_option
s
(
argv
)
for
crontab
in
args
[
1
:]:
print
(
'
Checking correctness of %s
'
%
crontab
)
return
check
.
check_crontab
(
crontab
,
log
,
options
[
'
whitelisted_users
'
])
def
get_whitelisted_user
s
(
argv
):
"""
Gets the list of whitelisted users, if any
.
def
parse_chkcrontab_option
s
(
argv
):
"""
Parse the options for chkcrontab
.
Args:
argv: The argument string supplied by the caller.
Returns:
The list of whitelisted users.
options: A dictionary of options and their values.
args: Remaining arguments.
"""
parser
=
OptionParser
()
parser
.
add_option
(
'
-w
'
,
'
--whitelist
'
,
dest
=
'
whitelisted_users
'
,
action
=
'
append
'
,
help
=
'
A user to ignore when warning of unrecognized users This argument may be passed multiple times.
'
)
(
options
,
args
)
=
parser
.
parse_args
(
argv
)
if
options
.
whitelisted_users
:
return
options
.
whitelisted_users
else
:
return
None
return
parser
.
parse_args
(
argv
)
if
__name__
==
'
__main__
'
:
sys
.
exit
(
main
(
sys
.
argv
))
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