From 28e8d13b3c5c40d0164762ec28b208312400c9f8 Mon Sep 17 00:00:00 2001
From: Jeremy Jarrell <jjarrell@listhub.com>
Date: Tue, 11 Jun 2013 15:53:54 -0400
Subject: [PATCH] Extracts the logic to determine if whitelisted users are
specified into a separate method.
---
chkcrontab | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/chkcrontab b/chkcrontab
index c0a218d..6952bf2 100755
--- a/chkcrontab
+++ b/chkcrontab
@@ -36,15 +36,16 @@ def main(argv):
print('ERROR: No crontab file was specified.')
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:
for arg in argv:
if '--whitelist' in arg:
- whitelisted_users = arg['--whitelist='.__len__():].split(',')
-
- log = check.LogCounter()
- print('Checking correctness of %s' % argv[1])
- return check.check_crontab(argv[1], log, whitelisted_users)
+ return arg['--whitelist='.__len__():].split(',')
+ return None
if __name__ == '__main__':
sys.exit(main(sys.argv))
\ No newline at end of file
--
GitLab