Hi Lists,

A while ago dsd reported that after an initial "failed" registration,
it registration was broken. This turned out to be after registering
with no network, or with an invalid network. This is tracked in
http://bugs.sugarlabs.org/ticket/1940 (and in a few places in OLPC's
trac too).

Clearly, some python lib caches stale DNS resolver data, and refuses
to let go, but we didn't know where the problem was.

The anaconda folks have just hit the same prob, and fixed it. We
probably need to do the same on the appropriate NM event...

cheers, m

---------- Forwarded message ----------
From: Chris Lumens <[email protected]>
Date: Wed, May 12, 2010 at 2:49 PM
Subject: [PATCH rhel6-branch] Reset the resolver cache after bringing
up the network (#587032).
To: [email protected]


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
[email protected]
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



-- 
 [email protected]
 [email protected] -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
_______________________________________________
Sugar-devel mailing list
[email protected]
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to