[PATCH rhel6-branch] Reset the resolver cache after bringing up the network (#587032).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Throughout stage2 if we bring up the network after doing various actions,
we need to make sure the DNS resolver is reset to pick up the new information.
However, pycurl/libcurl uses the c-ares resolver which does not have a
method similar to res_init.  Instead we need to tear down the pycurl.Curl
object instance cached in urlgrabber and create a new one.  This does the
same thing as re-reading /etc/resolv.conf, but in more steps.
---
 anaconda.spec.in |    4 ++--
 iw/task_gui.py   |    5 +++++
 yuminstall.py    |   12 +++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/anaconda.spec.in b/anaconda.spec.in
index 0085724..6c6cb92 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -71,7 +71,7 @@ BuildRequires: newt-devel
 BuildRequires: pango-devel
 BuildRequires: pykickstart >= %{pykickstartver}
 BuildRequires: python-devel
-BuildRequires: python-urlgrabber
+BuildRequires: python-urlgrabber >= 3.9.1-5
 BuildRequires: rpm-devel
 BuildRequires: rpm-python >= %{rpmpythonver}
 BuildRequires: slang-devel >= %{slangver}
@@ -98,7 +98,7 @@ Requires: parted >= %{partedver}
 Requires: pyparted >= %{pypartedver}
 Requires: yum >= %{yumver}
 Requires: libxml2-python
-Requires: python-urlgrabber
+Requires: python-urlgrabber >= 3.9.1-5
 Requires: system-logos
 Requires: pykickstart >= %{pykickstartver}
 Requires: system-config-date >= %{syscfgdatever}
diff --git a/iw/task_gui.py b/iw/task_gui.py
index ae2889d..ded1008 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -35,6 +35,7 @@ import network
 import iutil
 
 from yuminstall import AnacondaYumRepo
+import urlgrabber.grabber
 import yum.Errors
 
 import logging
@@ -530,6 +531,8 @@ class TaskWindow(InstallWindow):
             if not self.anaconda.intf.enableNetwork():
                 return gtk.RESPONSE_CANCEL
 
+            urlgrabber.grabber.reset_curl_obj()
+
         dialog = RepoEditor(self.anaconda, repo)
         dialog.createDialog()
         dialog.run()
@@ -579,6 +582,8 @@ class TaskWindow(InstallWindow):
                 if not self.anaconda.intf.enableNetwork():
                     return
 
+                urlgrabber.grabber.reset_curl_obj()
+
             repo.enable()
             if not setupRepo(self.anaconda, repo):
                 return
diff --git a/yuminstall.py b/yuminstall.py
index 1d54f24..307c6fb 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -455,6 +455,8 @@ class AnacondaYum(YumSorter):
                         self._baseRepoURL = None
                         return
 
+                    urlgrabber.grabber.reset_curl_obj()
+
                 self._switchImage(1)
                 self.mediagrabber = self.mediaHandler
             elif m.startswith("http") or m.startswith("ftp:"):
@@ -464,6 +466,8 @@ class AnacondaYum(YumSorter):
                     if not self.anaconda.intf.enableNetwork():
                         self._baseRepoURL = None
 
+                    urlgrabber.grabber.reset_curl_obj()
+
                 (opts, server, path) = iutil.parseNfsUrl(m)
                 isys.mount(server+":"+path, self.tree, "nfs", options=opts)
 
@@ -833,6 +837,8 @@ class AnacondaYum(YumSorter):
             if not self.anaconda.intf.enableNetwork():
                 return
 
+            urlgrabber.grabber.reset_curl_obj()
+
         rc = self.anaconda.intf.messageWindow(_("Error"),
                    _("The file %s cannot be opened.  This is due to a missing "
                      "file, a corrupt package or corrupt media.  Please "
@@ -1203,6 +1209,8 @@ debuglevel=10
                        custom_buttons=[_("_Exit installer")])
                    sys.exit(1)
 
+               urlgrabber.grabber.reset_curl_obj()
+
         self.doRepoSetup(anaconda)
         self.doSackSetup(anaconda)
         self.doGroupSetup(anaconda)
@@ -1281,7 +1289,9 @@ debuglevel=10
                     if repo.needsNetwork() and not network.hasActiveNetDev():
                         if anaconda.intf.enableNetwork():
                             repo.mirrorlistparsed = False
-                            continue
+                            continue 
+
+                        urlgrabber.grabber.reset_curl_obj()
 
                     buttons = [_("_Exit installer"), _("Edit"), _("_Retry")]
                 else:
-- 
1.7.0.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux