Example #1
0
    def runTest(self):
        conf = Config(
            programName="CallbacksTest",
            programVersion="1.0",
            callbackDict={"callback1": (callback1, False), "callback2": (callback2, False)},
        )

        # another way to register callback
        conf.register_callback("callback3", callback2)

        # callback with given item name already registered
        with self.assertRaises(ConfigError):
            conf.register_callback("callback3", callback3)

        # should not raise exception
        conf.register_callback("callback3", callback3, override=True)

        conf.register_callback("callback4", callback4, attchmnt_only=True)
        conf.register_callback("callback5", callback5, attchmnt_only=False)

        # should not raise exception
        dump = self.dump(conf, None)

        self.assertIn("callback1:\nThis was generated by the callback1\n", dump)
        self.assertIn("callback2:\nThis was generated by the callback2\n", dump)
        self.assertIn("callback3: Caused error", dump)

        # should not appear in the dump (attachment only)
        self.assertNotIn("callback4", dump)

        # should not appear in the dump (nothing provided)
        self.assertNotIn("callback5", dump)
Example #2
0
    def runTest(self):
        conf = Config(programName="CallbacksTest",
                      programVersion="1.0",
                      callbackDict={"callback1": (callback1, False),
                                    "callback2": (callback2, False)})

        # another way to register callback
        conf.register_callback("callback3", callback2)

        # callback with given item name already registered
        with self.assertRaises(ConfigError):
            conf.register_callback("callback3", callback3)

        # should not raise exception
        conf.register_callback("callback3", callback3, override=True)

        conf.register_callback("callback4", callback4, attchmnt_only=True)
        conf.register_callback("callback5", callback5, attchmnt_only=False)

        # should not raise exception
        dump = self.dump(conf, None)

        self.assertIn("callback1:\nThis was generated by the callback1\n",
                      dump)
        self.assertIn("callback2:\nThis was generated by the callback2\n",
                      dump)
        self.assertIn("callback3: Caused error", dump)

        # should not appear in the dump (attachment only)
        self.assertNotIn("callback4", dump)

        # should not appear in the dump (nothing provided)
        self.assertNotIn("callback5", dump)
Example #3
0
def initExceptionHandling(anaconda):
    fileList = [
        "/tmp/anaconda.log", "/tmp/packaging.log", "/tmp/program.log",
        "/tmp/storage.log", "/tmp/ifcfg.log", "/tmp/dnf.log",
        "/tmp/dnf.rpm.log", "/tmp/yum.log",
        iutil.getSysroot() + "/root/install.log", "/proc/cmdline"
    ]

    if os.path.exists("/tmp/syslog"):
        fileList.extend(["/tmp/syslog"])

    if anaconda.opts and anaconda.opts.ksfile:
        fileList.extend([anaconda.opts.ksfile])

    conf = Config(
        programName="anaconda",
        programVersion=startup_utils.get_anaconda_version_string(),
        programArch=os.uname()[4],
        attrSkipList=[
            "_intf._actions", "_intf._currentAction._xklwrapper",
            "_intf._currentAction._spokes[\"KeyboardSpoke\"]._xkl_wrapper",
            "_intf._currentAction._storage_playground",
            "_intf._currentAction._spokes[\"CustomPartitioningSpoke\"]._storage_playground",
            "_intf._currentAction.language.translations",
            "_intf._currentAction.language.locales",
            "_intf._currentAction._spokes[\"PasswordSpoke\"]._oldweak",
            "_intf._currentAction._spokes[\"PasswordSpoke\"]._password",
            "_intf._currentAction._spokes[\"UserSpoke\"]._password",
            "_intf._currentAction._spokes[\"UserSpoke\"]._oldweak",
            "_intf.storage.bootloader.password", "_intf.storage.data",
            "_intf.storage.encryptionPassphrase",
            "_bootloader.encrypted_password", "_bootloader.password",
            "payload._groups", "payload._yum"
        ],
        localSkipList=["passphrase", "password", "_oldweak", "_password"],
        fileList=fileList)

    conf.register_callback("lsblk_output", lsblk_callback, attchmnt_only=True)
    conf.register_callback("nmcli_dev_list",
                           nmcli_dev_list_callback,
                           attchmnt_only=True)
    conf.register_callback("type", lambda: "anaconda", attchmnt_only=True)
    conf.register_callback("addons", list_addons_callback, attchmnt_only=False)

    if "/tmp/syslog" not in fileList:
        # no syslog, grab output from journalctl and put it also to the
        # anaconda-tb file
        conf.register_callback("journalctl",
                               journalctl_callback,
                               attchmnt_only=False)

    interactive = not anaconda.displayMode == 'c'
    handler = AnacondaExceptionHandler(conf, anaconda.intf.meh_interface,
                                       ReverseExceptionDump,
                                       anaconda.intf.tty_num,
                                       anaconda.gui_initialized, interactive)
    handler.install(anaconda)

    return conf
def initExceptionHandling(anaconda):
    fileList = ["/tmp/anaconda.log", "/tmp/packaging.log",
                "/tmp/program.log", "/tmp/storage.log", "/tmp/ifcfg.log",
                "/tmp/dnf.librepo.log", "/tmp/hawkey.log",
                "/tmp/lvm.log", iutil.getSysroot() + "/root/install.log",
                "/proc/cmdline"]

    if os.path.exists("/tmp/syslog"):
        fileList.extend(["/tmp/syslog"])

    if anaconda.opts and anaconda.opts.ksfile:
        fileList.extend([anaconda.opts.ksfile])

    conf = Config(programName="anaconda",
                  programVersion=startup_utils.get_anaconda_version_string(),
                  programArch=os.uname()[4],
                  attrSkipList=["_intf._actions",
                                "_intf._currentAction._xklwrapper",
                                "_intf._currentAction._spokes[\"KeyboardSpoke\"]._xkl_wrapper",
                                "_intf._currentAction._storage_playground",
                                "_intf._currentAction._spokes[\"CustomPartitioningSpoke\"]._storage_playground",
                                "_intf._currentAction.language.translations",
                                "_intf._currentAction.language.locales",
                                "_intf._currentAction._spokes[\"PasswordSpoke\"]._oldweak",
                                "_intf._currentAction._spokes[\"PasswordSpoke\"]._password",
                                "_intf._currentAction._spokes[\"UserSpoke\"]._password",
                                "_intf._currentAction._spokes[\"UserSpoke\"]._oldweak",
                                "_intf.storage.bootloader.password",
                                "_intf.storage.data",
                                "_intf.storage.ksdata",
                                "_intf.storage.encryption_passphrase",
                                "_intf.data",
                                "_bootloader.encrypted_password",
                                "_bootloader.password",
                                "payload._groups"],
                  localSkipList=["passphrase", "password", "_oldweak", "_password", "try_passphrase"],
                  fileList=fileList)

    conf.register_callback("lsblk_output", lsblk_callback, attchmnt_only=True)
    conf.register_callback("nmcli_dev_list", nmcli_dev_list_callback,
                           attchmnt_only=True)
    conf.register_callback("type", lambda: "anaconda", attchmnt_only=True)
    conf.register_callback("addons", list_addons_callback, attchmnt_only=False)

    if "/tmp/syslog" not in fileList:
        # no syslog, grab output from journalctl and put it also to the
        # anaconda-tb file
        conf.register_callback("journalctl", journalctl_callback, attchmnt_only=False)

    interactive = not anaconda.displayMode == 'c'
    handler = AnacondaExceptionHandler(conf, anaconda.intf.meh_interface,
                                       AnacondaReverseExceptionDump, anaconda.intf.tty_num,
                                       anaconda.gui_initialized, interactive)
    handler.install(anaconda)

    return conf
Example #5
0
def initExceptionHandling(anaconda):
    fileList = [ "/tmp/anaconda.log", "/tmp/packaging.log",
                 "/tmp/program.log", "/tmp/storage.log", "/tmp/ifcfg.log",
                 "/tmp/yum.log", ROOT_PATH + "/root/install.log",
                 "/proc/cmdline" ]

    if os.path.exists("/tmp/syslog"):
        fileList.extend(["/tmp/syslog"])

    if anaconda.opts and anaconda.opts.ksfile:
        fileList.extend([anaconda.opts.ksfile])

    conf = Config(programName="anaconda",
                  programVersion=isys.getAnacondaVersion(),
                  programArch=os.uname()[4],
                  attrSkipList=["_intf._actions",
                                "_intf._currentAction._xklwrapper",
                                "_intf._currentAction._spokes[\"KeyboardSpoke\"]._xkl_wrapper",
                                "_intf._currentAction._storage_playground",
                                "_intf._currentAction._spokes[\"CustomSpoke\"]._storage_playground",
                                "_intf._currentAction.language.translations",
                                "_intf._currentAction.language.locales",
                                "_intf._currentAction._spokes[\"PasswordSpoke\"]._oldweak",
                                "_intf._currentAction._spokes[\"PasswordSpoke\"]._password",
                                "_intf._currentAction._spokes[\"UserSpoke\"]._password",
                                "_intf._currentAction._spokes[\"UserSpoke\"]._oldweak",
                                "_intf.storage.bootloader.password",
                                "_intf.storage.data",
                                "_intf.storage.encryptionPassphrase",
                                "_bootloader.encrypted_password",
                                "_bootloader.password",
                                "payload._groups",
                                "payload._yum"],
                  localSkipList=[ "passphrase", "password", "_oldweak", "_password" ],
                  fileList=fileList)

    conf.register_callback("lsblk_output", lsblk_callback, attchmnt_only=True)
    conf.register_callback("nmcli_dev_list", nmcli_dev_list_callback,
                           attchmnt_only=True)
    conf.register_callback("type", lambda: "anaconda", attchmnt_only=True)
    conf.register_callback("addons", list_addons_callback, attchmnt_only=False)

    if "/tmp/syslog" not in fileList:
        # no syslog, grab output from journalctl and put it also to the
        # anaconda-tb file
        conf.register_callback("journalctl", journalctl_callback, attchmnt_only=False)

    handler = AnacondaExceptionHandler(conf, anaconda.intf.meh_interface,
                                       ReverseExceptionDump, anaconda.intf.tty_num)
    handler.install(anaconda)

    return conf
Example #6
0
def initExceptionHandling(anaconda):
    file_list = [
        "/tmp/anaconda.log", "/tmp/packaging.log", "/tmp/program.log",
        "/tmp/storage.log", "/tmp/dnf.librepo.log", "/tmp/hawkey.log",
        "/tmp/lvm.log",
        util.getSysroot() + "/root/install.log", "/proc/cmdline",
        "/root/lorax-packages.log", "/tmp/blivet-gui-utils.log",
        "/tmp/dbus.log"
    ]

    if os.path.exists("/tmp/syslog"):
        file_list.extend(["/tmp/syslog"])

    if anaconda.opts and anaconda.opts.ksfile:
        file_list.extend([anaconda.opts.ksfile])

    config = Config(
        programName="anaconda",
        programVersion=util.get_anaconda_version_string(),
        programArch=os.uname()[4],
        attrSkipList=[
            "_intf._actions", "_intf._currentAction._xklwrapper",
            "_intf._currentAction._spokes[\"KeyboardSpoke\"]._xkl_wrapper",
            "_intf._currentAction._storage_playground",
            "_intf._currentAction._spokes[\"CustomPartitioningSpoke\"]._storage_playground",
            "_intf._currentAction.language.translations",
            "_intf._currentAction.language.locales",
            "_intf._currentAction._spokes[\"PasswordSpoke\"]._oldweak",
            "_intf._currentAction._spokes[\"PasswordSpoke\"]._password",
            "_intf._currentAction._spokes[\"UserSpoke\"]._password",
            "_intf._currentAction._spokes[\"UserSpoke\"]._oldweak",
            "_intf.storage.bootloader.password", "_intf.storage.data",
            "_intf.storage.ksdata", "_intf.storage.encryption_passphrase",
            "_intf.data", "_bootloader.encrypted_password",
            "_bootloader.password", "payload._groups"
        ],
        localSkipList=[
            "passphrase", "password", "_oldweak", "_password", "try_passphrase"
        ],
        fileList=file_list)

    config.register_callback("lsblk_output",
                             lsblk_callback,
                             attchmnt_only=False)
    config.register_callback("nmcli_dev_list",
                             nmcli_dev_list_callback,
                             attchmnt_only=True)

    # provide extra information for libreport
    config.register_callback("type", lambda: "anaconda", attchmnt_only=True)
    config.register_callback("addons",
                             list_addons_callback,
                             attchmnt_only=False)

    if "/tmp/syslog" not in file_list:
        # no syslog, grab output from journalctl and put it also to the
        # anaconda-tb file
        config.register_callback("journalctl",
                                 journalctl_callback,
                                 attchmnt_only=False)

    if not product.isFinal:
        config.register_callback("release_type",
                                 lambda: "pre-release",
                                 attchmnt_only=True)

    handler = AnacondaExceptionHandler(config, anaconda.intf.meh_interface,
                                       AnacondaReverseExceptionDump,
                                       anaconda.intf.tty_num,
                                       anaconda.gui_initialized,
                                       anaconda.interactive_mode)
    handler.install(anaconda)

    return config