[Yum-devel] [PATCH] Expose and document the ip_resolve option. BZ 730533

Zdeněk Pavlas zpavlas at redhat.com
Tue Aug 16 08:31:04 UTC 2011


URLGrabber already implements it.
---
 docs/yum.conf.5 |   13 +++++++++++++
 yum/config.py   |    5 +++++
 yum/yumRepo.py  |    1 +
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index bd86eea..91beff5 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -313,6 +313,14 @@ with the \fBthrottle\fR option (above). If \fBthrottle\fR is a percentage and
 ignored. Default is `0' (no bandwidth throttling). 
 
 .IP
+\fBip_resolve \fR
+Determines how yum resolves host names.
+
+`4' or `IPv4': resolve to IPv4 addresses only.
+
+`6' or `IPv6': resolve to IPv6 addresses only.
+
+.IP
 \fBsslcacert \fR
 Path to the directory containing the databases of the certificate authorities
 yum should use to verify SSL certificates. Defaults to none - uses system
@@ -768,6 +776,11 @@ repository.
 Overrides the \fBbandwidth\fR option from the [main] section for this
 repository.
 
+.IP
+\fBip_resolve \fR
+Overrides the \fBip_resolve\fR option from the [main] section for this
+repository.
+
 
 .IP
 \fBsslcacert \fR
diff --git a/yum/config.py b/yum/config.py
index bbeca66..b0fd4f8 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -775,6 +775,9 @@ class YumConf(StartupConf):
 
     bandwidth = BytesOption(0)
     throttle = ThrottleOption(0)
+    ip_resolve = CaselessSelectionOption(
+            allowed = ('ipv4', 'ipv6', 'whatever'),
+            mapper  = {'4': 'ipv4', '6': 'ipv6'})
 
     http_caching = SelectionOption('all', ('none', 'packages', 'all'))
     metadata_expire = SecondsOption(60 * 60 * 6) # Time in seconds (6h).
@@ -916,6 +919,8 @@ class RepoConf(BaseConfig):
     bandwidth = Inherit(YumConf.bandwidth)
     throttle = Inherit(YumConf.throttle)
     timeout = Inherit(YumConf.timeout)
+    ip_resolve = Inherit(YumConf.ip_resolve)
+
     http_caching = Inherit(YumConf.http_caching)
     metadata_expire = Inherit(YumConf.metadata_expire)
     mirrorlist_expire = Inherit(YumConf.mirrorlist_expire)
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 7375813..11fbf0a 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -501,6 +501,7 @@ class YumRepository(Repository, config.RepoConf):
                  'throttle': self.throttle,
                  'proxies': self.proxy_dict,
                  'timeout': self.timeout,
+                 'ip_resolve': self.ip_resolve,
                  'http_headers': tuple(self.__headersListFromDict(cache=cache)),
                  'ssl_verify_peer': self.sslverify,
                  'ssl_verify_host': self.sslverify,
-- 
1.7.4.4



More information about the Yum-devel mailing list