[PATCH] Bring back the askmethod parameter (#889887).

Chris Lumens clumens at redhat.com
Fri Feb 8 21:45:38 UTC 2013


We've got this shiny new method selection UI but if you want to use it, you've
first got to sit through the delay of fetching metadata for the closest mirror
which might be completely wrong for you.  Thus, this parameter will skip the
default action.  Entering and leaving the source spoke will unset this
parameter.
---
 anaconda                           |  4 ++++
 dracut/parse-anaconda-options.sh   |  1 -
 pyanaconda/flags.py                |  1 +
 pyanaconda/packaging/yumpayload.py | 12 +++++++++++-
 pyanaconda/ui/gui/spokes/source.py |  5 +++++
 5 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/anaconda b/anaconda
index 10d1abb..fc81b91 100755
--- a/anaconda
+++ b/anaconda
@@ -234,6 +234,7 @@ def parseOptions(argv=None, cmdline=None):
     op.add_option("--multilib", dest="multiLib", action="store_true", default=False)
 
     op.add_option("-m", "--method", dest="method", default=None)
+    op.add_option("--askmethod", dest="askmethod", action="store_true", default=False)
     op.add_option("--repo", dest="method", default=None)
     op.add_option("--stage2", dest="stage2", default=None)
     op.add_option("--noverifyssl", action="store_true", default=False)
@@ -655,6 +656,9 @@ if __name__ == "__main__":
     if opts.images:
         flags.imageInstall = True
 
+    if opts.askmethod:
+        flags.askmethod = True
+
     # Set up logging as early as possible.
     import logging
     from pyanaconda import anaconda_log
diff --git a/dracut/parse-anaconda-options.sh b/dracut/parse-anaconda-options.sh
index 0bc7605..aa9c6b9 100755
--- a/dracut/parse-anaconda-options.sh
+++ b/dracut/parse-anaconda-options.sh
@@ -86,7 +86,6 @@ check_removed_arg ethtool
 
 # interactive junk in initramfs
 # (maybe we'll bring it back someday?)
-check_removed_arg askmethod "Use an appropriate 'inst.repo=' argument instead."
 check_removed_arg asknetwork "Use an appropriate 'ip=' argument instead."
 
 # lang & keymap
diff --git a/pyanaconda/flags.py b/pyanaconda/flags.py
index fdbd504..673822c 100644
--- a/pyanaconda/flags.py
+++ b/pyanaconda/flags.py
@@ -67,6 +67,7 @@ class Flags(object):
         self.noverifyssl = False
         self.imageInstall = False
         self.automatedInstall = False
+        self.askmethod = False
         # for non-physical consoles like some ppc and sgi altix,
         # we need to preserve the console device and not try to
         # do things like bogl on them.  this preserves what that
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 9fe60ad..c72b69f 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -25,7 +25,6 @@
     TODO
         - document all methods
         - YumPayload
-            - preupgrade
             - write test cases
             - more logging in key methods
             - handling of proxy needs cleanup
@@ -416,6 +415,17 @@ reposdir=%s
         # start with a fresh YumBase instance
         self.reset(root=root)
 
+        # If askmethod was given on the command line, we don't want to do
+        # anything.  Just disable all repos and return.  This should avoid
+        # metadata fetching.
+        if flags.askmethod:
+            with _yum_lock:
+                for repo in self._yum.repos.repos.values():
+                    self.disableRepo(repo.id)
+
+            self._yumCacheDirHack()
+            return
+
         # see if we can get a usable base repo from self.data.method
         try:
             self._configureBaseRepo(self.storage, checkmount=checkmount)
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 87ebb89..5751ca0 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -439,6 +439,11 @@ class SourceSpoke(NormalSpoke):
     def apply(self):
         import copy
 
+        # If askmethod was provided on the command line, entering the source
+        # spoke wipes that out.
+        if flags.askmethod:
+            flags.askmethod = False
+
         old_source = copy.copy(self.data.method)
 
         if self._autodetectButton.get_active():
-- 
1.7.11.2



More information about the anaconda-patches mailing list