def _doExecute(self):
     self._ready = False
     # nkwin7 add begin
     # keywords:indirect and direct; default selected disks; show correctly messages
     # the indirect spoke need not communicate with hub.
     #hubQ.send_not_ready(self.__class__.__name__)
     #hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except StorageError as e:
         log.error("storage configuration failed: %s" % e)
         StorageChecker.errors = str(e).split("\n")
         #hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         self._applyDiskSelection(self.selected_disks)
     else:
         if self.autopart:
             # this was already run as part of doAutoPartition. dumb.
             StorageChecker.errors = []
             StorageChecker.warnings = []
             self.run()
     finally:
         self._ready = True
Example #2
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Example #3
0
 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartParseError) as e:
         log.error("storage configuration failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autopart_type = self.data.autopart.type
         self.storage.reset()
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
     else:
         print(_("Checking storage configuration..."))
         report = storage_checker.check(self.storage)
         print("\n".join(report.all_errors))
         report.log(log)
         self.errors = report.errors
         self.warnings = report.warnings
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
Example #4
0
 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         print _("storage configuration failed: %s") % e
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autoPartType = self.data.clearpart.type
         self.storage.reset()
         self._ready = True
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         print _("storage configuration failed: %s") % e
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self._ready = True
     else:
         print(_("Checking storage configuration..."))
         (self.errors, self.warnings) = self.storage.sanityCheck()
         self._ready = True
         for e in self.errors:
             log.error(e)
             print e
         for w in self.warnings:
             log.warn(w)
             print w
Example #5
0
    def execute(self):
        print(_("Generating updated storage configuration"))
        try:
            doKickstartStorage(self.storage, self.data, self.instclass)
        except (StorageError, KickstartParseError) as e:
            log.error("storage configuration failed: %s", e)
            print(_("storage configuration failed: %s") % e)
            self.errors = [str(e)]

            # Prepare for reset.
            self._bootloader_observer.proxy.SetDrive(BOOTLOADER_DRIVE_UNSET)
            self._disk_init_observer.proxy.SetInitializationMode(CLEAR_PARTITIONS_ALL)
            self._disk_init_observer.proxy.SetInitializeLabelsEnabled(False)
            self.storage.autopart_type = self.data.autopart.type

            # The reset also calls self.storage.config.update().
            self.storage.reset()

            # Now set data back to the user's specified config.
            applyDiskSelection(self.storage, self.data, self.selected_disks)
        except BootLoaderError as e:
            log.error("BootLoader setup failed: %s", e)
            print(_("storage configuration failed: %s") % e)
            self.errors = [str(e)]
            self._bootloader_observer.proxy.SetDrive(BOOTLOADER_DRIVE_UNSET)
        else:
            print(_("Checking storage configuration..."))
            report = storage_checker.check(self.storage)
            print("\n".join(report.all_errors))
            report.log(log)
            self.errors = report.errors
            self.warnings = report.warnings
        finally:
            resetCustomStorageData(self.data)
            self._ready = True
Example #6
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__,
                       _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Example #7
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         self._applyDiskSelection(self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             # this was already run as part of doAutoPartition. dumb.
             StorageChecker.errors = []
             StorageChecker.warnings = []
             self.run()
     finally:
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Example #8
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     hubQ.send_message(self.__class__.__name__,
                       _("Saving storage configuration..."))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         self._applyDiskSelection(self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart:
             # this was already run as part of doAutoPartition. dumb.
             StorageChecker.errors = []
             StorageChecker.warnings = []
             self.run()
     finally:
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Example #9
0
 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, BootLoaderError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         print _("storage configuration failed: %s") % e
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autoPartType = self.data.clearpart.type
         self.storage.reset()
         self._ready = True
     else:
         print(_("Checking storage configuration..."))
         (self.errors, self.warnings) = self.storage.sanityCheck()
         self._ready = True
         for e in self.errors:
             log.error(e)
             print e
         for w in self.warnings:
             log.warn(w)
             print w
Example #10
0
 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartParseError) as e:
         log.error("storage configuration failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autopart_type = self.data.autopart.type
         self.storage.reset()
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
     else:
         print(_("Checking storage configuration..."))
         report = storage_checker.check(self.storage)
         print("\n".join(report.all_errors))
         report.log(log)
         self.errors = report.errors
         self.warnings = report.warnings
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
Example #11
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__,
                       _("Saving storage configuration..."))
     if flags.automatedInstall and self.data.autopart.encrypted and not self.data.autopart.passphrase:
         self.autopart_missing_passphrase = True
         StorageChecker.errors = [
             _("Passphrase for autopart encryption not specified.")
         ]
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
         return
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartParseError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__,
                           _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart or (flags.automatedInstall and
                              (self.data.autopart.autopart
                               or self.data.partition.seen)):
             # run() executes StorageChecker.checkStorage in a seperate threat
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Example #12
0
    def _run(self):
        from blivet.errors import StorageError

        # Set up disks/blivet.
        try:
            self.setupDisks()

            # Parse the kickstart using anaconda's parser, since it has more
            # advanced error detection.  This also requires having storage set
            # up first.
            parser = AnacondaKSParser(AnacondaKSHandler())
            parser.readKickstartFromString(self.ks)

            instClass = DefaultInstall()

            doKickstartStorage(self._blivet, parser.handler, instClass)
            self._blivet.updateKSData()
            self._blivet.doIt()
        except (KickstartError, StorageError) as e:
            # anaconda handles expected kickstart errors (like parsing busted
            # input files) by printing the error and quitting.  For testing, an
            # error might be expected so we should compare the result here with
            # what is expected.
            if self.expectedExceptionType and isinstance(
                    e, self.expectedExceptionType):
                # We expected an exception, and we got one of the correct type.
                # If it also contains the string we were expecting, then the
                # test case passes.  Otherwise, it's a failure.
                if self.expectedExceptionText and self._text_matches(str(e)):
                    return
                else:
                    raise FailedTest(str(e), self.expectedExceptionText)
            else:
                # We either got an exception when we were not expecting one,
                # or we got one of a type other than what we were expecting.
                # Either of these cases indicates a failure of the test case.
                raise FailedTest(e, self.expectedExceptionType)
        finally:
            self.tearDownDisks()

        if self.expectedExceptionType:
            raise FailedTest(None, self.expectedExceptionType)

        return
Example #13
0
    def _run(self):
        from blivet.errors import StorageError

        # Set up disks/blivet.
        try:
            self.setupDisks()

            # Parse the kickstart using anaconda's parser, since it has more
            # advanced error detection.  This also requires having storage set
            # up first.
            parser = AnacondaKSParser(AnacondaKSHandler())
            parser.readKickstartFromString(self.ks)

            instClass = DefaultInstall()

            doKickstartStorage(self._blivet, parser.handler, instClass)
            self._blivet.updateKSData()
            self._blivet.doIt()
        except (KickstartError, StorageError) as e:
            # anaconda handles expected kickstart errors (like parsing busted
            # input files) by printing the error and quitting.  For testing, an
            # error might be expected so we should compare the result here with
            # what is expected.
            if self.expectedExceptionType and isinstance(e, self.expectedExceptionType):
                # We expected an exception, and we got one of the correct type.
                # If it also contains the string we were expecting, then the
                # test case passes.  Otherwise, it's a failure.
                if self.expectedExceptionText and self._text_matches(str(e)):
                    return
                else:
                    raise FailedTest(str(e), self.expectedExceptionText)
            else:
                # We either got an exception when we were not expecting one,
                # or we got one of a type other than what we were expecting.
                # Either of these cases indicates a failure of the test case.
                raise FailedTest(e, self.expectedExceptionType)
        finally:
            self.tearDownDisks()

        if self.expectedExceptionType:
            raise FailedTest(None, self.expectedExceptionType)

        return
Example #14
0
 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autoPartType = self.data.autopart.type
         self.storage.reset()
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
     else:
         print(_("Checking storage configuration..."))
         exns = sanity_check(self.storage)
         errors = [
             exn.message for exn in exns if isinstance(exn, SanityError)
         ]
         warnings = [
             exn.message for exn in exns if isinstance(exn, SanityWarning)
         ]
         (self.errors, self.warnings) = (errors, warnings)
         for e in self.errors:
             log.error(e)
             print(e)
         for w in self.warnings:
             log.warning(w)
             print(w)
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
Example #15
0
 def _doExecute(self):
     self._ready = False
     hubQ.send_not_ready(self.__class__.__name__)
     # on the off-chance dasdfmt is running, we can't proceed further
     threadMgr.wait(constants.THREAD_DASDFMT)
     hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
     if flags.automatedInstall and self.data.autopart.encrypted and not self.data.autopart.passphrase:
         self.autopart_missing_passphrase = True
         StorageChecker.errors = [_("Passphrase for autopart encryption not specified.")]
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
         return
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartParseError) as e:
         log.error("storage configuration failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
         self.data.ignoredisk.drives = []
         self.data.ignoredisk.onlyuse = []
         self.storage.config.update(self.data)
         self.storage.reset()
         self.disks = getDisks(self.storage.devicetree)
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         StorageChecker.errors = str(e).split("\n")
         hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
         self.data.bootloader.bootDrive = ""
     else:
         if self.autopart or (flags.automatedInstall and (self.data.autopart.autopart or self.data.partition.seen)):
             # run() executes StorageChecker.checkStorage in a seperate threat
             self.run()
     finally:
         resetCustomStorageData(self.data)
         self._ready = True
         hubQ.send_ready(self.__class__.__name__, True)
Example #16
0
 def execute(self):
     print(_("Generating updated storage configuration"))
     try:
         doKickstartStorage(self.storage, self.data, self.instclass)
     except (StorageError, KickstartValueError) as e:
         log.error("storage configuration failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
         self.data.clearpart.type = CLEARPART_TYPE_ALL
         self.data.clearpart.initAll = False
         self.storage.config.update(self.data)
         self.storage.autoPartType = self.data.autopart.type
         self.storage.reset()
         # now set ksdata back to the user's specified config
         applyDiskSelection(self.storage, self.data, self.selected_disks)
     except BootLoaderError as e:
         log.error("BootLoader setup failed: %s", e)
         print(_("storage configuration failed: %s") % e)
         self.errors = [str(e)]
         self.data.bootloader.bootDrive = ""
     else:
         print(_("Checking storage configuration..."))
         exns = sanity_check(self.storage)
         errors = [str(exn) for exn in exns if isinstance(exn, SanityError)]
         warnings = [str(exn) for exn in exns if isinstance(exn, SanityWarning)]
         (self.errors, self.warnings) = (errors, warnings)
         for e in self.errors:
             log.error(e)
             print(e)
         for w in self.warnings:
             log.warning(w)
             print(w)
     finally:
         resetCustomStorageData(self.data)
         self._ready = True