From: "Brian C. Lane" bcl@redhat.com
It ends up enabledPlugins is just the list we gave yum to load, it doesn't reflect success or failure. If a plugin is actually loaded it is added to the internal dict plugins._plugins
Related: rhbz#876135 --- pyanaconda/packaging/yumpayload.py | 2 +- pyanaconda/ui/gui/spokes/source.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py index 3ce95d1..4926e96 100644 --- a/pyanaconda/packaging/yumpayload.py +++ b/pyanaconda/packaging/yumpayload.py @@ -420,7 +420,7 @@ reposdir=%s @property def mirrorEnabled(self): with _yum_lock: - return "fastestmirror" in self._yum.plugins.enabledPlugins + return "fastestmirror" in self._yum.plugins._plugins
def getRepo(self, repo_id): """ Return the yum repo object. """ diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py index e49f163..8dd8ba2 100644 --- a/pyanaconda/ui/gui/spokes/source.py +++ b/pyanaconda/ui/gui/spokes/source.py @@ -641,10 +641,13 @@ class SourceSpoke(NormalSpoke): combo = self.builder.get_object("isoPartitionCombo") combo.set_active(active)
- # We default to the mirror list, and then if the method tells us - # something different later, we can change it. - self._protocolComboBox.set_active(PROTOCOL_MIRROR) - self._urlEntry.set_sensitive(False) + # We default to the mirror list if available. http otherwise + if self.payload.mirrorEnabled: + self._protocolComboBox.set_active(PROTOCOL_MIRROR) + self._urlEntry.set_sensitive(False) + else: + self._protocolComboBox.set_active(PROTOCOL_HTTP) + self._urlEntry.set_sensitive(True)
# Set up the default state of UI elements. if self.data.method.method == "url":
From: "Brian C. Lane" bcl@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
On Tue, 2013-09-03 at 17:55 -0700, Brian C. Lane wrote:
From: "Brian C. Lane" bcl@redhat.com
It ends up enabledPlugins is just the list we gave yum to load, it doesn't reflect success or failure. If a plugin is actually loaded it is added to the internal dict plugins._plugins
Related: rhbz#876135
pyanaconda/packaging/yumpayload.py | 2 +- pyanaconda/ui/gui/spokes/source.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py index 3ce95d1..4926e96 100644 --- a/pyanaconda/packaging/yumpayload.py +++ b/pyanaconda/packaging/yumpayload.py @@ -420,7 +420,7 @@ reposdir=%s @property def mirrorEnabled(self): with _yum_lock:
return "fastestmirror" in self._yum.plugins.enabledPlugins
return "fastestmirror" in self._yum.plugins._plugins
def getRepo(self, repo_id): """ Return the yum repo object. """
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py index e49f163..8dd8ba2 100644 --- a/pyanaconda/ui/gui/spokes/source.py +++ b/pyanaconda/ui/gui/spokes/source.py @@ -641,10 +641,13 @@ class SourceSpoke(NormalSpoke): combo = self.builder.get_object("isoPartitionCombo") combo.set_active(active)
# We default to the mirror list, and then if the method tells us
# something different later, we can change it.
self._protocolComboBox.set_active(PROTOCOL_MIRROR)
self._urlEntry.set_sensitive(False)
# We default to the mirror list if available. http otherwise
if self.payload.mirrorEnabled:
self._protocolComboBox.set_active(PROTOCOL_MIRROR)
self._urlEntry.set_sensitive(False)
else:
self._protocolComboBox.set_active(PROTOCOL_HTTP)
self._urlEntry.set_sensitive(True) # Set up the default state of UI elements. if self.data.method.method == "url":
These both look good to me.
anaconda-patches@lists.fedorahosted.org