Skip to main content
Sign in
Snippets Groups Projects
Commit 28e8d13b authored by Jeremy Jarrell's avatar Jeremy Jarrell
Browse files

Extracts the logic to determine if whitelisted users are specified into a separate method.

parent a90c3192
Branches
Tags
No related merge requests found
...@@ -36,15 +36,16 @@ def main(argv): ...@@ -36,15 +36,16 @@ def main(argv):
print('ERROR: No crontab file was specified.') print('ERROR: No crontab file was specified.')
sys.exit(1) sys.exit(1)
whitelisted_users = None log = check.LogCounter()
print('Checking correctness of %s' % argv[1])
return check.check_crontab(argv[1], log, get_whitelisted_users(argv))
def get_whitelisted_users(argv):
if len(argv) > 2: if len(argv) > 2:
for arg in argv: for arg in argv:
if '--whitelist' in arg: if '--whitelist' in arg:
whitelisted_users = arg['--whitelist='.__len__():].split(',') return arg['--whitelist='.__len__():].split(',')
return None
log = check.LogCounter()
print('Checking correctness of %s' % argv[1])
return check.check_crontab(argv[1], log, whitelisted_users)
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main(sys.argv)) sys.exit(main(sys.argv))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment