Add get_mirror_list function stub to packages.py that just returns the given repo list. Useful for local sites to create a way to return a prioritized list of repos. 
Modify autotest.py to call get_mirror_list before appending the repos to the control file
Risk: Medium
Visibility: Low

Signed-off-by: Scott Zawalski <scottz@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2279 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/packages.py b/client/common_lib/packages.py
index dd8906d..da74549 100644
--- a/client/common_lib/packages.py
+++ b/client/common_lib/packages.py
@@ -342,9 +342,15 @@
             if upload_path.startswith('ssh://'):
                 # parse ssh://user@host/usr/local/autotest/packages
                 hostline, remote_path = self._parse_ssh_path(upload_path)
-                utils.run('scp %s %s:%s' % (file_path, hostline, remote_path))
-                r_path = os.path.join(remote_path, os.path.basename(file_path))
-                utils.run("ssh %s 'chmod 644 %s'" % (hostline, r_path))
+                try:
+                    utils.run('scp %s %s:%s' % (file_path, hostline,
+                                                remote_path))
+                    r_path = os.path.join(remote_path,
+                                          os.path.basename(file_path))
+                    utils.run("ssh %s 'chmod 644 %s'" % (hostline, r_path))
+                except error.CmdError:
+                    print "Error uploading to repository " + upload_path
+                    pass
             else:
                 shutil.copy(file_path, upload_path)
                 os.chmod(os.path.join(upload_path,
@@ -367,10 +373,14 @@
         try:
             if upload_path.startswith('ssh://'):
                 hostline, remote_path = self._parse_ssh_path(upload_path)
-                utils.run('scp %s %s:%s' % (local_path, hostline,
-                                              remote_path))
-                ssh_path = os.path.join(remote_path, "*")
-                utils.run("ssh %s 'chmod 644 %s'" % (hostline, ssh_path))
+                try:
+                    utils.run('scp %s %s:%s' % (local_path, hostline,
+                                                remote_path))
+                    ssh_path = os.path.join(remote_path, "*")
+                    utils.run("ssh %s 'chmod 644 %s'" % (hostline, ssh_path))
+                except error.CmdError:
+                    print "Error uploading to repository: " + upload_path
+                    pass
             else:
                 utils.run("cp %s %s " % (local_path, upload_path))
                 up_path = os.path.join(upload_path, "*")
@@ -424,6 +434,20 @@
                                      % (file_name, pkg_dir, why))
 
 
+    def get_mirror_list(self, hostname):
+        '''
+            Stub function for site specific mirror.
+
+            Args:
+                hostname: Host that the mirrors are decided for
+                repos: current fetch_locations 
+
+            Returns:
+                Priority ordered list
+        '''
+        return self.repo_urls
+
+
     def _get_checksum_file_path(self):
         '''
         Return the complete path of the checksum file (assumed to be stored