---
 docs/yum.conf.5 |  4 +++-
 yum/config.py   | 10 +++++++++-
 yum/yumRepo.py  |  5 ++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index eccfa38..39c2769 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -504,7 +504,9 @@ syslog logging is disabled.  Default is `/dev/log'.
 
 .IP
 \fBproxy \fR
-URL to the proxy server that yum should use.
+URL to the proxy server that yum should use.  Set this to `libproxy'
+to enable proxy auto configuration via libproxy.  Defaults to direct
+connection.
 
 .IP
 \fBproxy_username \fR
diff --git a/yum/config.py b/yum/config.py
index 967a4c8..1ca5cdc 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -237,6 +237,14 @@ class UrlOption(Option):
         else:
             return '%s or %s' % (', '.join(self.schemes[:-1]), 
self.schemes[-1])
 
+class ProxyOption(UrlOption):
+    """ Just like URLOption but accept "libproxy" too.
+    """
+    def parse(self, proxy):
+        if proxy.strip().lower() == 'libproxy':
+            return 'libproxy'
+        return UrlOption.parse(self, proxy)
+
 class UrlListOption(ListOption):
     """Option for handling lists of URLs with validation of the URL
     scheme.
@@ -735,7 +743,7 @@ class YumConf(StartupConf):
     commands = ListOption()
     exclude = ListOption()
     failovermethod = Option(__main_failovermethod_default__)
-    proxy = UrlOption(default=False, schemes=('http', 'ftp', 'https',
+    proxy = ProxyOption(default=False, schemes=('http', 'ftp', 'https',
         'socks4', 'socks4a', 'socks5', 'socks5h'), allow_none=True)
     proxy_username = Option()
     proxy_password = Option()
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index ef6d9c6..cfe7b05 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -655,7 +655,6 @@ class YumRepository(Repository, config.RepoConf):
                  'bandwidth': self.bandwidth,
                  'retry': self.retries,
                  'throttle': self.throttle,
-                 'proxies': self.proxy_dict,
                  'timeout': self.timeout,
                  'minrate': self.minrate,
                  'ip_resolve': self.ip_resolve,
@@ -669,6 +668,10 @@ class YumRepository(Repository, config.RepoConf):
                  'username': self.username,
                  'password': self.password,
                  }
+        if self.proxy == 'libproxy':
+            opts['libproxy'] = True
+        else:
+            opts['proxies'] = self.proxy_dict
         return opts
 
     def _getgrabfunc(self):
-- 
1.7.11.7

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to