Example #1
0
    def instClass(self):
        if not self._instClass:
            from pyanaconda.installclass import factory

            # Get install class by name.
            if self.ksdata.anaconda.installclass.seen:
                name = self.ksdata.anaconda.installclass.name
                self._instClass = factory.get_install_class_by_name(name)
            # Or just find the best one.
            else:
                self._instClass = factory.get_best_install_class()

        return self._instClass
Example #2
0
    def instClass(self):
        if not self._instClass:
            from pyanaconda.installclass import factory

            # Get install class by name.
            if self.ksdata.anaconda.installclass.seen:
                name = self.ksdata.anaconda.installclass.name
                self._instClass = factory.get_install_class_by_name(name)
            # Or just find the best one.
            else:
                self._instClass = factory.get_best_install_class()

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

        # Set up disks/blivet.
        try:
            # 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 = factory.get_best_install_class()

            self.setupDisks(parser.handler)

            doKickstartStorage(self._storage, parser.handler, instClass)
            self._storage.update_ksdata()
            self._storage.devicetree.teardown_all()
            self._storage.do_it()
        except (BootLoaderError, 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)
Example #4
0
    def _run(self):
        from blivet.errors import StorageError

        # Set up disks/blivet.
        try:
            # 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 = factory.get_best_install_class()

            self.setupDisks(parser.handler)

            doKickstartStorage(self._blivet, parser.handler, instClass)
            self._blivet.updateKSData()
            self._blivet.devicetree.teardownAll()
            self._blivet.doIt()
        except (BootLoaderError, 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)