290 if policyfile != None: #policy file present |
290 if policyfile != None: #policy file present |
291 try: |
291 try: |
292 value = fileutils.read_policy_content(policyfile) |
292 value = fileutils.read_policy_content(policyfile) |
293 if value not in self._binary.keys(): #check policy file is valid |
293 if value not in self._binary.keys(): #check policy file is valid |
294 _logger.error("POLICY_ERROR: policy file found %s but policy %s value not exists in csv" % (policyfile, value)) |
294 _logger.error("POLICY_ERROR: policy file found %s but policy %s value not exists in csv" % (policyfile, value)) |
295 except Exception, exc: |
295 except IOError, exc: |
296 _logger.error("POLICY_ERROR: %s" % exc) |
296 _logger.error("POLICY_ERROR: %s" % exc) |
297 value = self._config.get('policy.default.value', MISSING_POLICY) |
297 value = self._config.get('policy.default.value', MISSING_POLICY) |
298 else: #no policy file present |
298 else: #no policy file present |
299 filePresent = False |
299 filePresent = False |
300 dirPresent = False |
300 dirPresent = False |
406 |
406 |
407 def __init__(self, config, archiver): |
407 def __init__(self, config, archiver): |
408 """ Initialization. """ |
408 """ Initialization. """ |
409 PolicyRemoverMapper.__init__(self, config, archiver) |
409 PolicyRemoverMapper.__init__(self, config, archiver) |
410 |
410 |
411 def load_policy_binary(self, csvfile): |
411 def load_policy_binary(self, csvfile, column=1): |
412 """ Loading the policy using the 3rd column. """ |
412 """ Loading the policy using the 3rd column. """ |
413 _logger.info("POLICY_INFO: Loading actions from the 3rd column") |
413 _logger.info("POLICY_INFO: Loading actions from the 3rd column") |
414 PolicyRemoverMapper.load_policy_binary(self, csvfile, column=3) |
414 PolicyRemoverMapper.load_policy_binary(self, csvfile, column=3) |
415 |
415 |
416 class EPLPolicyRemoverMapper(PolicyRemoverMapper): |
416 class EPLPolicyRemoverMapper(PolicyRemoverMapper): |
417 """ Implement an EPL column based policy remover. """ |
417 """ Implement an EPL column based policy remover. """ |
418 def __init__(self, config, archiver): |
418 def __init__(self, config, archiver): |
419 """ Initialization. """ |
419 """ Initialization. """ |
420 PolicyRemoverMapper.__init__(self, config, archiver) |
420 PolicyRemoverMapper.__init__(self, config, archiver) |
421 |
421 |
422 def load_policy_binary(self, csvfile): |
422 def load_policy_binary(self, csvfile, column=1): |
423 """ Loading the policy using the 4th column. """ |
423 """ Loading the policy using the 4th column. """ |
424 _logger.info("POLICY_INFO: Loading actions from the 4th column") |
424 _logger.info("POLICY_INFO: Loading actions from the 4th column") |
425 PolicyRemoverMapper.load_policy_binary(self, csvfile, column=4) |
425 PolicyRemoverMapper.load_policy_binary(self, csvfile, column=4) |
426 |
426 |
427 |
427 |