Update packager to be a bit more picky about what it runs upkeep on

Signed-off-by: Scott Zawalski <[email protected]>

--- autotest/client/common_lib/base_packages.py 2010-06-22 10:32:24.000000000 
-0700
+++ autotest/client/common_lib/base_packages.py 2010-06-22 10:32:24.000000000 
-0700
@@ -74,6 +74,8 @@
 
 
 def trim_custom_directories(repo, older_than_days=40):
+    if not repo:
+        return
     older_than_days = global_config.global_config.get_config_value('PACKAGES',
                                                       'custom_max_age',
                                                       type=int)
@@ -266,6 +268,8 @@
         ensure we have at least XX amount of free space
         Make sure we can write to the repo
         '''
+        if not repo.startswith('/') and not repo.startswith('ssh:'):
+            return
         try:
             check_diskspace(repo)
             check_write(repo)
@@ -280,11 +284,21 @@
         '''
         from autotest_lib.server import subcommand
         if not custom_repos:
-            custom_repos = 
global_config.global_config.get_config_value('PACKAGES',
-                                               
'custom_upload_location').split(',')
-            custom_download = global_config.global_config.get_config_value(
-                'PACKAGES', 'custom_download_location')
-            custom_repos += [custom_download]
+            # Not all package types necessairly require or allow custom repos
+            try:
+                custom_repos = global_config.global_config.get_config_value(
+                    'PACKAGES', 'custom_upload_location').split(',')
+            except global_config.ConfigError:
+                custom_repos = []
+            try:
+                custom_download = global_config.global_config.get_config_value(
+                    'PACKAGES', 'custom_download_location')
+                custom_repos += [custom_download]
+            except global_config.ConfigError:
+                pass
+
+            if not custom_repos:
+                return
 
         results = subcommand.parallel_simple(trim_custom_directories,
                                              custom_repos, log=False, )
@@ -425,7 +439,8 @@
         raise error.PackageFetchError(message)
 
 
-    def upload_pkg(self, pkg_path, upload_path=None, update_checksum=False):
+    def upload_pkg(self, pkg_path, upload_path=None, update_checksum=False,
+                   timeout=300):
         from autotest_lib.server import subcommand
         if upload_path:
             upload_path_list = [upload_path]
@@ -447,7 +462,7 @@
                                                   (pkg_path, path,
                                                    update_checksum)))
 
-        results = subcommand.parallel(commands, 300, return_results=True)
+        results = subcommand.parallel(commands, timeout, return_results=True)
         for result in results:
             if result:
                 print str(result)
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to