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

Re: [PATCH] No one likes the welcome step anymore, so remove it.



I love the welcome step, it was a great place for me to force a failure
when testing traceback handling [1]! :)  Just kidding, this seems like a
great change to reduce the # of steps.

Side topic ... I use the following patch in an updates.img to force a
traceback at the welcome step (cmdline, text and gui).  Can you
recommend a new place I should inspect to inject a failure during
installation?

[1]
https://fedoraproject.org/wiki/QA:Testcase_Anaconda_save_traceback_to_bugzilla

Thanks,
James

On Mon, 2010-10-11 at 15:03 -0400, Chris Lumens wrote:
> ---
>  pyanaconda/__init__.py           |   21 ------------
>  pyanaconda/dispatch.py           |    1 -
>  pyanaconda/gui.py                |    1 -
>  pyanaconda/installclass.py       |    1 -
>  pyanaconda/iw/welcome_gui.py     |   68 --------------------------------------
>  pyanaconda/kickstart.py          |    1 -
>  pyanaconda/text.py               |    1 -
>  pyanaconda/textw/welcome_text.py |   47 --------------------------
>  pyanaconda/upgrade.py            |    1 -
>  9 files changed, 0 insertions(+), 142 deletions(-)
>  delete mode 100644 pyanaconda/iw/welcome_gui.py
>  delete mode 100644 pyanaconda/textw/welcome_text.py
> 
> diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
> index c52e4f7..b167bd5 100644
> --- a/pyanaconda/__init__.py
> +++ b/pyanaconda/__init__.py
> @@ -285,27 +285,6 @@ class Anaconda(object):
>          else:
>              self.methodstr = methodstr
>  
> -    def requiresNetworkInstall(self):
> -        fail = False
> -        numNetDevs = isys.getNetworkDeviceCount()
> -
> -        if self.methodstr is not None:
> -            if (self.methodstr.startswith("http") or \
> -                self.methodstr.startswith("ftp://";) or \
> -                self.methodstr.startswith("nfs:")) and \
> -               numNetDevs == 0:
> -                fail = True
> -        elif self.stage2 is not None:
> -            if self.stage2.startswith("cdrom://") and \
> -               not os.path.isdir("/mnt/stage2/Packages") and \
> -               numNetDevs == 0:
> -                fail = True
> -
> -        if fail:
> -            log.error("network install required, but no network devices available")
> -
> -        return fail
> -
>      def write(self):
>          self.writeXdriver()
>          self.instLanguage.write(self.rootPath)
> diff --git a/pyanaconda/dispatch.py b/pyanaconda/dispatch.py
> index 39aa2d9..a8becb7 100644
> --- a/pyanaconda/dispatch.py
> +++ b/pyanaconda/dispatch.py
> @@ -66,7 +66,6 @@ log = logging.getLogger("anaconda")
>  # All install steps take the anaconda object as their sole argument.  This
>  # gets passed in when we call the function.
>  installSteps = [
> -    ("welcome", ),
>      ("language", ),
>      ("keyboard", ),
>      ("betanag", betaNagScreen, ),
> diff --git a/pyanaconda/gui.py b/pyanaconda/gui.py
> index e555ec7..16289fe 100755
> --- a/pyanaconda/gui.py
> +++ b/pyanaconda/gui.py
> @@ -64,7 +64,6 @@ mainWindow = None
>  stepToClass = {
>      "language" : ("language_gui", "LanguageWindow"),
>      "keyboard" : ("kbd_gui", "KeyboardWindow"),
> -    "welcome" : ("welcome_gui", "WelcomeWindow"),
>      "filtertype" : ("filter_type", "FilterTypeWindow"),
>      "filter" : ("filter_gui", "FilterWindow"), 
>      "zfcpconfig" : ("zfcp_gui", "ZFCPWindow"),
> diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
> index 197f1e7..8bc2e53 100644
> --- a/pyanaconda/installclass.py
> +++ b/pyanaconda/installclass.py
> @@ -78,7 +78,6 @@ class BaseInstallClass(object):
>  	dispatch.setStepList(
>  		 "language",
>  		 "keyboard",
> -		 "welcome",
>                   "filtertype",
>                   "filter",
>                   "storageinit",
> diff --git a/pyanaconda/iw/welcome_gui.py b/pyanaconda/iw/welcome_gui.py
> deleted file mode 100644
> index c30aece..0000000
> --- a/pyanaconda/iw/welcome_gui.py
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -#
> -# welcome_gui.py: gui welcome screen.
> -#
> -# Copyright (C) 2000, 2001, 2002  Red Hat, Inc.  All rights reserved.
> -#
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License as published by
> -# the Free Software Foundation; either version 2 of the License, or
> -# (at your option) any later version.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> -#
> -
> -import gtk
> -from pyanaconda import gui
> -import sys
> -from iw_gui import *
> -
> -from pyanaconda.constants import *
> -import gettext
> -_ = lambda x: gettext.ldgettext("anaconda", x)
> -
> -class WelcomeWindow (InstallWindow):
> -
> -    windowTitle = "" #N_("Welcome")
> -
> -    def __init__ (self, ics):
> -        InstallWindow.__init__ (self, ics)
> -        ics.setGrabNext (1)
> -        self.anaconda = None
> -
> -    # WelcomeWindow tag="wel"
> -    def getScreen (self, anaconda):
> -        self.anaconda = anaconda
> -        # this is a bit ugly... but scale the image if we're not at 800x600
> -        (w, h) = self.ics.cw.window.get_size_request()
> -        if w >= 800:
> -            height = None
> -            width = None
> -        else:
> -            width = 500
> -            height = 258
> -        pix = gui.readImageFromFile("splash.png", width, height, dither=False)
> -        box = gtk.EventBox ()
> -        box.add (pix)
> -        return box
> -
> -    def getNext (self):
> -        if self.anaconda.requiresNetworkInstall():
> -            self.anaconda.intf.messageWindow(_("Network Install Required"),
> -                                             _("Your installation source is set to "
> -                                               "a network location, but no network "
> -                                               "devices were found on your "
> -                                               "system.  To avoid a network "
> -                                               "installation, boot with the full "
> -                                               "DVD, full CD set, or do not pass "
> -                                               "a repo= parameter that specifies "
> -                                               "a network source."),
> -                                             type="custom",
> -                                             custom_icon="error",
> -                                             custom_buttons=[_("E_xit Installer")])
> -            sys.exit(0)
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index 8df032e..bc1d8b6 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -1449,7 +1449,6 @@ def setSteps(anaconda):
>          anaconda.instClass.setSteps(anaconda)
>          dispatch.skipStep("findrootparts")
>  
> -    dispatch.skipStep("welcome")
>      dispatch.skipStep("betanag")
>      dispatch.skipStep("network")
>  
> diff --git a/pyanaconda/text.py b/pyanaconda/text.py
> index 3e52978..0605b08 100644
> --- a/pyanaconda/text.py
> +++ b/pyanaconda/text.py
> @@ -50,7 +50,6 @@ log = logging.getLogger("anaconda")
>  stepToClasses = {
>      "language" : ("language_text", "LanguageWindow"),
>      "keyboard" : ("keyboard_text", "KeyboardWindow"),
> -    "welcome" : ("welcome_text", "WelcomeWindow"),
>      "parttype" : ("partition_text", "PartitionTypeWindow"),
>      "addswap" : ("upgrade_text", "UpgradeSwapWindow"),
>      "upgrademigratefs" : ("upgrade_text", "UpgradeMigrateFSWindow"),
> diff --git a/pyanaconda/textw/welcome_text.py b/pyanaconda/textw/welcome_text.py
> deleted file mode 100644
> index 3cddf17..0000000
> --- a/pyanaconda/textw/welcome_text.py
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -#
> -# welcome_text.py: text mode welcome window
> -#
> -# Copyright (C) 2001, 2002  Red Hat, Inc.  All rights reserved.
> -#
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License as published by
> -# the Free Software Foundation; either version 2 of the License, or
> -# (at your option) any later version.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> -#
> -
> -from snack import *
> -from constants_text import *
> -from pyanaconda.constants import *
> -import sys
> -import gettext
> -_ = lambda x: gettext.ldgettext("anaconda", x)
> -
> -class WelcomeWindow:
> -    def __call__(self, screen, anaconda):
> -        rc = ButtonChoiceWindow(screen, _("%s") % (productName,),
> -                                _("Welcome to %s!\n\n")
> -                                % (productName, ),
> -                                buttons = [TEXT_OK_BUTTON], width = 50,
> -                                help = "welcome")
> -
> -        if anaconda.requiresNetworkInstall():
> -            anaconda.intf.messageWindow(_("Network Install Required"),
> -                                        _("Your installation source is set to "
> -                                          "a network location, but no network "
> -                                          "devices were found on your "
> -                                          "system.  To avoid a network "
> -                                          "installation, boot with the full "
> -                                          "DVD, full CD set, or do not pass "
> -                                          "a repo= parameter that specifies "
> -                                          "a network source."))
> -            sys.exit(0)
> -
> -        return INSTALL_OK
> diff --git a/pyanaconda/upgrade.py b/pyanaconda/upgrade.py
> index 221a5c6..c2726fb 100644
> --- a/pyanaconda/upgrade.py
> +++ b/pyanaconda/upgrade.py
> @@ -319,7 +319,6 @@ def setSteps(anaconda):
>      dispatch.setStepList(
>                  "language",
>                  "keyboard",
> -                "welcome",
>                  "filtertype",
>                  "filter",
>                  "cleardiskssel",


diff --git a/pyanaconda/cmdline.py b/pyanaconda/cmdline.py
index 1034479..6f4bf26 100644
--- a/pyanaconda/cmdline.py
+++ b/pyanaconda/cmdline.py
@@ -69,6 +69,7 @@ class InstallInterface(InstallInterfaceBase):
 #        signal.signal(signal.SIGINT, signal.SIG_IGN)
         signal.signal(signal.SIGTSTP, signal.SIG_DFL)
         self.instProgress = None
+        raise Exception("This failure intentionally triggered.")
 
     def __del__(self):
         pass
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 18fc43c..952924e 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -89,6 +89,27 @@ class AnacondaExceptionHandler(ExceptionHandler):
         pdb.post_mortem (tb)
         os.kill(os.getpid(), signal.SIGKILL)
 
+class RandomExceptionDump(ReverseExceptionDump):
+    @property
+    def hash(self):
+        """Create a random hash depending on whether 'randomize-tb' on the
+           command-line.  This will determine whether a new bugzilla is created, or
+           whether an existing bug is found.
+           https://fedoraproject.org/wiki/QA:Testcase_Anaconda_save_traceback_to_bugzilla
+        """
+
+        fd = open("/proc/cmdline", "r")
+        cmdline_txt = fd.read()
+        fd.close()
+
+        # Generate a random traceback hash?
+        if "randomize_tb" in cmdline_txt:
+            import hashlib
+            s = os.urandom(512)
+            return hashlib.sha256(s).hexdigest()
+        else:
+            return super(RandomExceptionDump, self).hash
+
 def initExceptionHandling(anaconda):
     fileList = [ "/tmp/anaconda.log", "/tmp/lvmout", "/tmp/resize.out",
                  "/tmp/program.log", "/tmp/storage.log", "/tmp/yum.log",
@@ -129,7 +150,7 @@ def initExceptionHandling(anaconda):
                                ],
                   localSkipList=[ "passphrase", "password" ],
                   fileList=fileList)
-    handler = AnacondaExceptionHandler(conf, anaconda.intf, ReverseExceptionDump)
+    handler = AnacondaExceptionHandler(conf, anaconda.intf, RandomExceptionDump)
     handler.install(anaconda)
 
     return conf
diff --git a/pyanaconda/iw/welcome_gui.py b/pyanaconda/iw/welcome_gui.py
index c30aece..0f65efb 100644
--- a/pyanaconda/iw/welcome_gui.py
+++ b/pyanaconda/iw/welcome_gui.py
@@ -34,6 +34,7 @@ class WelcomeWindow (InstallWindow):
         InstallWindow.__init__ (self, ics)
         ics.setGrabNext (1)
         self.anaconda = None
+        raise Exception("This failure intentionally triggered")
 
     # WelcomeWindow tag="wel"
     def getScreen (self, anaconda):
diff --git a/pyanaconda/textw/welcome_text.py b/pyanaconda/textw/welcome_text.py
index 3cddf17..ef5fbf2 100644
--- a/pyanaconda/textw/welcome_text.py
+++ b/pyanaconda/textw/welcome_text.py
@@ -25,6 +25,9 @@ import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 
 class WelcomeWindow:
+    def __init__(self):
+        raise Exception("This failure intentionally triggered")
+
     def __call__(self, screen, anaconda):
         rc = ButtonChoiceWindow(screen, _("%s") % (productName,),
                                 _("Welcome to %s!\n\n")

Attachment: signature.asc
Description: This is a digitally signed message part


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