def automatedInstalls(self): """ Handles automated installs @rtype: nothing @returns: nothing """ try: self.__logger.info("Unattended installation (auto mode - kickstart)") # Check entitlement self.__logger.info("Checking entitlement...") if not isEntitled(self.__data): self.__logger.critical("Hardware is not entitled, aborting installation!") raise PKVMError("CONTROLLER", "INSTALLPROGRESS", "ENTITLEMENT") self.__viewer.getMessageWindow().show(GETTING_DISK_INFORMATION.localize()) self.__partitioner.getDiskInfo() self.__partitioner.detectPreviousInstalls() # automated installation action selected: perform required operations if self.__data['model'].get('action') == 'install': # get given disk on kickstart disk = self.getDiskAutoInstall(self.__data['model'].get('disk')) # install system on given disk self.__logger.info("Automated install on %s" % disk) self.installProgress(disk) # automated reinstallation action selected: perform required operations elif self.__data['model'].get('action') == 'reinstall': self.__logger.info("Automated reinstall") # preinstall module can't detect a previous system installed: abort if self.__partitioner.detectedPreviousInstall() is False: self.__logger.critical('Automated install failed: no previous system found') self.__viewer.getReinstallError().run() raise PKVMError("CONTROLLER", "AUTOINSTALL", "NO_PREINSTALL") # reinstall process can continue: call correct method # important: here the disk is not important, because we already # detected it to reinstall the system self.installProgress('') # automated upgrade action selected: perform required operations elif self.__data['model'].get('action') == 'upgrade': self.__logger.info("Automated upgrade") self.upgradeProgress(False) return except PKVMError as e: raise except Exception as e: self.__logger.critical(STR_VERSION + ": Unexpected error while executing kickstart.") self.__logger.critical("EXCEPTION:" + str(type(e))) self.__logger.critical(str(e)) self.__logger.critical("Stacktrace:" + str(traceback.format_exc())) raise PKVMError("CONTROLLER", "AUTOINSTALL", "UNEXPECTED_AUTOINSTALL")
def loop(self): """ Handles the main application loop @rtype: nothing @returns: nothing """ try: # Check if automated or not if self.__data['model'].get('action') in ['install', 'reinstall', 'upgrade']: self.automatedInstalls() self.__logger.info('Manual mode') language = choose_language(self.__viewer) # Check entitlement self.__logger.info("Checking entitlement...") if not isEntitled(self.__data): self.__logger.critical("Hardware is not entitled, aborting installation!") raise PKVMError("CONTROLLER", "INSTALLPROGRESS", "ENTITLEMENT") # obtain disk information and previous installs diskInfoWnd = self.__viewer.getMessageWindow() diskInfoWnd.show(GETTING_DISK_INFORMATION.localize()) self.__partitioner.getDiskInfo() self.__partitioner.detectPreviousInstalls() diskInfoWnd.popWindow() licenseRet = self.license(language) while True: if not licenseRet: language = choose_language(self.__viewer) licenseRet = self.license(language) continue # start the menu rc = self.menu() if rc == "back": language = choose_language(self.__viewer) licenseRet = self.license(language) except PKVMError as e: self.__logger.critical("PKVMError: %s" % e.getLogCode(e.args)) self.__createLog() self.__viewer.getGeneralTopError().run(e.getCode(e.args)) self.rebootSystem(True) except Exception as e: self.__logger.critical(STR_VERSION + ": Unexpected error (LOOP).") self.__logger.critical("EXCEPTION:" + str(type(e))) self.__logger.critical(str(e)) self.__logger.critical("Stacktrace:" + str(traceback.format_exc())) pkvmError = PKVMError() unexpectedCode = pkvmError.getUnexpectedCode("CONTROLLER", "LOOP") self.__logger.critical("PKVMError: %s" % pkvmError.getLogCode(unexpectedCode[0])) self.__createLog() self.__viewer.getGeneralTopError().run(unexpectedCode) self.rebootSystem(True)