]> Frank Brehm's Git Trees - my-stuff/py-logrotate.git/commitdiff
Mit Parsing config weitergemacht
authorFrank Brehm <frank@brehm-online.com>
Fri, 22 Apr 2011 07:32:03 +0000 (07:32 +0000)
committerFrank Brehm <frank@brehm-online.com>
Fri, 22 Apr 2011 07:32:03 +0000 (07:32 +0000)
git-svn-id: http://svn.brehm-online.com/svn/my-stuff/python/PyLogrotate/trunk@210 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa

LogRotateConfig.py

index 92615ab235d63d3fb016ce0438dce39b6f290aa1..a47dd18c1b3ee6bd04fbe5a0c2cbb160fe703366 100755 (executable)
@@ -245,6 +245,7 @@ class LogrotateConfigurationReader(object):
             'new_log':         self.new_log,
             'local_dir':       self.local_dir,
             'scripts':         self.scripts,
+            'shred_command':   self.shred_command,
             'taboo':           self.taboo,
             'verbose':         self.verbose,
         }
@@ -383,22 +384,38 @@ class LogrotateConfigurationReader(object):
     #------------------------------------------------------------
     def check_shred_command(self):
         '''
-        Checks the availibility of a check command. Sets self.check_command to
+        Checks the availibility of a check command. Sets self.shred_command to
         this system command or to None, if not found (including a warning).
         '''
 
         _ = self.t.lgettext
         path_list = self._get_std_search_path(True)
 
+        cmd = None
+        found = False
         for search_dir in path_list:
             if os.path.isdir(search_dir):
                 cmd = os.path.join(search_dir, 'shred')
+                if not os.path.isfile(cmd):
+                    continue
+                if os.access(cmd, os.X_OK):
+                    found = True
+                    break
             else:
                 self.logger.debug( _("Search path '%s' doesn't exists "
                                       + "or is not a directory")
                                    % (search_dir)
                 )
 
+        if found:
+            self.logger.debug( _("Shred command found: '%s'") %(cmd) )
+            self.shred_command = cmd
+            return True
+        else:
+            self.logger.warning( _("Shred command not found, shred disabled") )
+            self.shred_command = None
+            return False
+
     #------------------------------------------------------------
     def get_config(self):
         '''