예제 #1
0
 def CheckACrontab(self, arguments):
   log = check.LogCounter()
   (exp_warn, exp_fail, exp_rc) = self.GetExpWFRs(arguments.crontab)
   self.assertEquals(check.check_crontab(arguments, log), exp_rc,
                     'Failed to return %d for crontab errors.' % exp_rc)
   self.assertEquals(log.warn_count, exp_warn,
                     'Found %d warns not %d.' % (log.warn_count, exp_warn))
   self.assertEquals(log.error_count, exp_fail,
                     'Found %d errors not %d.' % (log.error_count, exp_fail))
예제 #2
0
 def CheckACrontab(self, crontab):
   log = check.LogCounter()
   crontab_file = os.path.join(BASE_PATH, crontab)
   (exp_warn, exp_fail, exp_rc) = self.GetExpWFRs(crontab_file)
   self.assertEquals(check.check_crontab(crontab_file, log), exp_rc,
                     'Failed to return %d for crontab errors.' % exp_rc)
   self.assertEquals(log.warn_count, exp_warn,
                     'Found %d warns not %d.' % (log.warn_count, exp_warn))
   self.assertEquals(log.error_count, exp_fail,
                     'Found %d errors not %d.' % (log.error_count, exp_fail))
예제 #3
0
 def CheckACrontab(self, crontab, whitelisted_users=None):
     log = check.LogCounter()
     crontab_file = os.path.join(BASE_PATH, crontab)
     (exp_warn, exp_fail, exp_rc) = self.GetExpWFRs(crontab_file)
     self.assertEquals(
         check.check_crontab(crontab_file, log, whitelisted_users),
         exp_rc,
         "Failed to return %d for crontab errors." % exp_rc,
     )
     self.assertEquals(log.warn_count, exp_warn, "Found %d warns not %d." % (log.warn_count, exp_warn))
     self.assertEquals(log.error_count, exp_fail, "Found %d errors not %d." % (log.error_count, exp_fail))
예제 #4
0
 def test_crontab_files_valid(self):
     """Crontab files should pass validation."""
     for filename in CRONTAB_FILES:
         cronlog = chkcrontab.LogCounter()
         return_value = chkcrontab.check_crontab(filename, cronlog)
         self.assertEqual(return_value, 0, 'Problem with ' + filename)
예제 #5
0
파일: tests.py 프로젝트: DerekRies/bedrock
 def test_crontab_files_valid(self):
     """Crontab files should pass validation."""
     for filename in CRONTAB_FILES:
         cronlog = chkcrontab.LogCounter()
         return_value = chkcrontab.check_crontab(filename, cronlog)
         self.assertEqual(return_value, 0, 'Problem with ' + filename)
예제 #6
0
def validate_cron(file_path):
    whitelisted_users = None
    log = check.LogCounter()
    return check.check_crontab(file_path, log, whitelisted_users)
예제 #7
0
def validate_cron(file_path):
    whitelisted_users = None
    log = check.LogCounter()
    return check.check_crontab(file_path, log, whitelisted_users)