From: Frank Brehm Date: Sun, 1 May 2011 21:18:47 +0000 (+0000) Subject: Mit Optionen weitergemacht X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=76398375d96909daad4c8e3a20d1e5570b95fbf7;p=my-stuff%2Fpy-logrotate.git Mit Optionen weitergemacht git-svn-id: http://svn.brehm-online.com/svn/my-stuff/python/PyLogrotate/trunk@221 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa --- diff --git a/LogRotateConfig.py b/LogRotateConfig.py index a1debb0..3e3a5ac 100755 --- a/LogRotateConfig.py +++ b/LogRotateConfig.py @@ -57,6 +57,14 @@ unsupported_options = ( 'error', ) +boolean_options = ( + 'compress', + 'copytruncate', + 'ifempty', + 'missingok', + 'sharedscripts', +) + #======================================================================== class LogrotateConfigurationError(Exception): @@ -906,6 +914,20 @@ class LogrotateConfigurationReader(object): ) return True + # Check for boolean option + pattern = r'^(not?)?(' + '|'.join(boolean_options) + r')$' + match = re.search(pattern, option, re.IGNORECASE) + if match: + negated = match.group(1) + key = match.group(2).lower() + if self.verbose > 4: + pass + if negated is None: + option_value = True + else: + option_value = False + + return True #------------------------------------------------------------