[PATCH] Do not raise UI dialog in stage2 if network is set in ks (#487503).

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

 



Asking in UI if ks settings fail is done depending on where we are in
the flow (e.g. ask when we are being or are going to be interactive anyway),
I'd appreciate checking my judgement here.
---
 iw/task_gui.py |   15 ++++++++++++---
 yuminstall.py  |   45 ++++++++++++++++++++++++++++++++-------------
 2 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/iw/task_gui.py b/iw/task_gui.py
index 30c28dc..ced2b72 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -501,7 +501,10 @@ class TaskWindow(InstallWindow):
             return
 
         if repo.needsNetwork() and not network.hasActiveNetDev():
-            if not self.anaconda.intf.enableNetwork():
+            # if network is set in ks and fails, ask in network conf dialog
+            if ((self.anaconda.isKickstart and self.anaconda.id.ksdata.network and
+                    not self.anaconda.id.network.bringUp()) and
+                not self.anaconda.intf.enableNetwork()):
                 return gtk.RESPONSE_CANCEL
 
         dialog = RepoEditor(self.anaconda, repo)
@@ -519,7 +522,10 @@ class TaskWindow(InstallWindow):
             return gtk.RESPONSE_CANCEL
 
         if dialog.repo.needsNetwork() and not network.hasActiveNetDev():
-            if not self.anaconda.intf.enableNetwork():
+            # if network is set in ks and fails, ask in network conf dialog
+            if ((self.anaconda.isKickstart and self.anaconda.id.ksdata.network and
+                    not self.anaconda.id.network.bringUp()) and
+                not self.anaconda.intf.enableNetwork()):
                 return gtk.RESPONSE_CANCEL
 
         s = self.xml.get_widget("repoList").get_model()
@@ -551,7 +557,10 @@ class TaskWindow(InstallWindow):
 
         if not wasChecked:
             if repo.needsNetwork() and not network.hasActiveNetDev():
-                if not self.anaconda.intf.enableNetwork():
+                # if network is set in ks and fails, ask in network conf dialog
+                if ((self.anaconda.isKickstart and self.anaconda.id.ksdata.network and
+                     not self.anaconda.id.network.bringUp()) and
+                    not self.anaconda.intf.enableNetwork()):
                     return
 
             repo.enable()
diff --git a/yuminstall.py b/yuminstall.py
index 99239d7..98348ab 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -420,7 +420,10 @@ class AnacondaYum(YumSorter):
 
                 # Calling _switchImage takes care of mounting /mnt/isodir first.
                 if not network.hasActiveNetDev():
-                    if not self.anaconda.intf.enableNetwork():
+                    # if there are ks network settings and they fail, don't ask in UI
+                    if ((self.anaconda.isKickstart and self.anaconda.id.ksdata.network and
+                            not self.anaconda.id.network.bringUp()) or
+                        not self.anaconda.intf.enableNetwork()):
                         self._baseRepoURL = None
                         return
 
@@ -430,7 +433,10 @@ class AnacondaYum(YumSorter):
                 self._baseRepoURL = m
             elif m.startswith("nfs:"):
                 if not network.hasActiveNetDev():
-                    if not self.anaconda.intf.enableNetwork():
+                    # if there are ks network settings and they fail, don't ask in UI
+                    if ((self.anaconda.isKickstart and self.anaconda.id.ksdata.network and
+                            not self.anaconda.id.network.bringUp()) or
+                        not self.anaconda.intf.enableNetwork()):
                         self._baseRepoURL = None
 
                 isys.mount(m[4:], self.tree, "nfs")
@@ -646,14 +652,18 @@ class AnacondaYum(YumSorter):
                 # to first do the mount, then translate it into a file:// that
                 # yum does understand.
                 if ksrepo.baseurl and ksrepo.baseurl.startswith("nfs://"):
-                    if not network.hasActiveNetDev() and not self.anaconda.intf.enableNetwork():
-                        self.anaconda.intf.messageWindow(_("No Network Available"),
-                            _("Some of your software repositories require "
-                              "networking, but there was an error enabling the "
-                              "network on your system."),
-                            type="custom", custom_icon="error",
-                            custom_buttons=[_("_Exit installer")])
-                        sys.exit(1)
+                    if not network.hasActiveNetDev():
+                        # if network is set in ks and fails, ask in network conf dialog
+                        if ((self.anaconda.id.ksdata.network and
+                             not self.anaconda.id.network.bringUp()) and
+                            not self.anaconda.intf.enableNetwork()):
+                            self.anaconda.intf.messageWindow(_("No Network Available"),
+                                _("Some of your software repositories require "
+                                  "networking, but there was an error enabling the "
+                                  "network on your system."),
+                                type="custom", custom_icon="error",
+                                custom_buttons=[_("_Exit installer")])
+                            sys.exit(1)
 
                     dest = tempfile.mkdtemp("", ksrepo.name, "/mnt")
 
@@ -716,7 +726,10 @@ class AnacondaYum(YumSorter):
         pkgFile = to_unicode(os.path.basename(package.remote_path))
 
         if package.repo.needsNetwork() and not network.hasActiveNetDev():
-            if not self.anaconda.intf.enableNetwork():
+            # if there are ks network settings and they fail, don't ask in UI
+            if ((self.anaconda.isKickstart and self.anaconda.id.ksdata.network and
+                    not self.anaconda.id.network.bringUp()) or
+                not self.anaconda.intf.enableNetwork()):
                 return
 
         rc = self.anaconda.intf.messageWindow(_("Error"),
@@ -1060,7 +1073,10 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
         # know this in advance.
         if len(filter(lambda r: r.needsNetwork(), self.ayum.repos.listEnabled())) > 0 and \
            not network.hasActiveNetDev():
-               if not anaconda.intf.enableNetwork():
+               # if network is set in ks and fails, ask in network conf dialog
+               if ((anaconda.isKickstart and anaconda.id.ksdata.network and
+                    not anaconda.id.network.bringUp()) and
+                   not anaconda.intf.enableNetwork()):
                    anaconda.intf.messageWindow(_("No Network Available"),
                        _("Some of your software repositories require "
                          "networking, but there was an error enabling the "
@@ -1145,7 +1161,10 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
                 except RepoError, e:
                     waitwin.pop()
                     if repo.needsNetwork() and not network.hasActiveNetDev():
-                        if anaconda.intf.enableNetwork():
+                        # if there are ks network settings and they fail, ask in UI
+                        if ((anaconda.isKickstart and anaconda.id.ksdata.network and
+                             anaconda.id.network.bringUp()) or
+                            anaconda.intf.enableNetwork()):
                             repo.mirrorlistparsed = False
                             continue
 
-- 
1.6.0.6

_______________________________________________
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