[master/rhel7 2/2] Remove Closest mirrors if no mirrors (#876135)

Brian C. Lane bcl at redhat.com
Wed Sep 4 00:55:18 UTC 2013


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
---
 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 020e392..f249577 100644
--- a/pyanaconda/ui/tui/spokes/source.py
+++ b/pyanaconda/ui/tui/spokes/source.py
@@ -44,7 +44,7 @@ class SourceSpoke(EditTUISpoke):
     title = _("Installation source")
     category = "source"
 
-    _protocols = (_("Closest mirror"), "http://", "https://", "ftp://", "nfs")
+    _protocols = ["http://", "https://", "ftp://", "nfs", _("Closest mirror")]
 
     # default to 'closest mirror', as done in the GUI
     _selection = 1
@@ -74,6 +74,10 @@ class SourceSpoke(EditTUISpoke):
         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 _repo_status(self):
@@ -146,13 +150,7 @@ class SourceSpoke(EditTUISpoke):
             if args == 2:
                 # network install
                 self._selection = num
-                if self._selection == 1:
-                    # closest mirror
-                    self.data.method.method = None
-                    self.apply()
-                    self.close()
-                    return True
-                elif self._selection in range(2, 5):
+                if 0 < self._selection < 4:
                     self.data.method.method = "url"
                     newspoke = SpecifyRepoSpoke(self.app, self.data, self.storage,
                                               self.payload, self.instclass, self._selection)
@@ -160,7 +158,7 @@ class SourceSpoke(EditTUISpoke):
                     self.apply()
                     self.close()
                     return True
-                elif self._selection == 5:
+                elif self._selection == 4:
                     # nfs
                     self.data.method.method = "nfs"
                     newspoke = SpecifyNFSRepoSpoke(self.app, self.data, self.storage,
@@ -169,6 +167,12 @@ class SourceSpoke(EditTUISpoke):
                     self.apply()
                     self.close()
                     return True
+                elif self._selection == 5 and self.payload.mirrorEnabled:
+                    # closest mirror
+                    self.data.method.method = None
+                    self.apply()
+                    self.close()
+                    return True
             else:
                 if num == 1:
                     # iso selected, just set some vars and return to main hub
-- 
1.8.3.1



More information about the anaconda-patches mailing list