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
def instClass(self): if not self._instClass: from pyanaconda.installclass import DefaultInstall self._instClass = DefaultInstall() return self._instClass
pass if not spokeClass: try: spokeClass = getattr(spokeModule, spokeClassName) except KeyError: print "%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName) sys.exit(1) print "Running %s %s from %s" % (spokeText, spokeClass, spokeModule) ksdata = makeVersion() storage = Blivet(ksdata=ksdata) storage.reset() instclass = DefaultInstall() payload = YumPayload(ksdata) payload.setup(storage) spoke = spokeClass(ksdata, storage, payload, instclass) if hasattr(spoke, "register_event_cb"): spoke.register_event_cb("continue", lambda: Gtk.main_quit()) spoke.register_event_cb("quit", lambda: Gtk.main_quit()) if hasattr(spoke, "set_path"): spoke.set_path( "categories", [("pyanaconda.ui.gui.categories.%s", os.path.join(os.path.dirname(__file__), "..", "categories"))]) spoke.set_path("spokes",