[rhel7-branch 3/29] Remove Closest mirrors if no mirrors (#876135)

bcl installerbot-noreply at redhat.com
Wed Jun 3 00:36:35 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

Text was always showing Closest mirrors, this makes it depend on the
same logic as the GUI source spoke (payload.mirrorEnabled) and moves it
to the end of the list to make the input handling easier to change.

Related: rhbz#876135
(cherry picked from commit ed0029897a545236771b1da5a143f10877ddbcb9)

Related: rhbz#1196721
---
 pyanaconda/ui/tui/spokes/source.py | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/pyanaconda/ui/tui/spokes/source.py b/pyanaconda/ui/tui/spokes/source.py
index b62f7ca..ed54c83 100644
--- a/pyanaconda/ui/tui/spokes/source.py
+++ b/pyanaconda/ui/tui/spokes/source.py
@@ -54,7 +54,7 @@ class SourceSpoke(EditTUISpoke, SourceSwitchHandler):
     title = N_("Installation source")
     category = SoftwareCategory
 
-    _protocols = (N_("Closest mirror"), "http://", "https://", "ftp://", "nfs")
+    _protocols = ("http://", "https://", "ftp://", "nfs", N_("Closest mirror"))
 
     # default to 'closest mirror', as done in the GUI
     _selection = 1
@@ -85,6 +85,10 @@ def _initialize(self):
         elif not flags.automatedInstall:
             self._cdrom = opticalInstallMedia(self.storage.devicetree)
 
+        # Only show Closest mirror if mirrors are available
+        if not self.payload.mirrorEnabled:
+            self._protocols.pop()
+
         self._ready = True
 
     def _payload_error(self):
@@ -162,13 +166,7 @@ def input(self, args, key):
         if args == 3:
             # network install
             self._selection = num
-            if self._selection == 1:
-                # closest mirror
-                self.set_source_closest_mirror()
-                self.apply()
-                self.close()
-                return INPUT_PROCESSED
-            elif self._selection in range(2, 5):
+            if 0 < self._selection < 4:
                 # preliminary URL source switch
                 self.set_source_url()
                 newspoke = SpecifyRepoSpoke(self.app, self.data, self.storage,
@@ -177,7 +175,7 @@ def input(self, args, key):
                 self.apply()
                 self.close()
                 return INPUT_PROCESSED
-            elif self._selection == 5:
+            elif self._selection == 4:
                 # nfs
                 # preliminary NFS source switch
                 self.set_source_nfs()
@@ -187,6 +185,12 @@ def input(self, args, key):
                 self.apply()
                 self.close()
                 return INPUT_PROCESSED
+            elif self._selection == 5:
+                # closest mirror
+                self.set_source_closest_mirror()
+                self.apply()
+                self.close()
+                return INPUT_PROCESSED
         elif num == 2:
             # local ISO file (HDD ISO)
             self._selection = num


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/335a2622a8d4bf69b9459794d0e29ce38fb30ed0


More information about the anaconda-patches mailing list