def connectToView(self): """Attempt to connect to self.vncconnecthost""" maxTries = 10 self.log.info(_("Attempting to connect to vnc client on host %s..."), self.vncconnecthost) if self.vncconnectport != "": hostarg = self.vncconnecthost + ":" + self.vncconnectport else: hostarg = self.vncconnecthost vncconfigcommand = [ self.root + "/usr/bin/vncconfig", "-display", ":%s" % constants.X_DISPLAY_NUMBER, "-connect", hostarg ] for _i in range(maxTries): vncconfp = iutil.startProgram( vncconfigcommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # vncconfig process err = vncconfp.communicate()[1].decode("utf-8") if err == '': self.log.info(_("Connected!")) return True elif err.startswith("connecting") and err.endswith("failed\n"): self.log.info(_("Will try to connect again in 15 seconds...")) time.sleep(15) continue else: log.critical(err) iutil.ipmi_abort(scripts=self.anaconda.ksdata.scripts) sys.exit(1) self.log.error( P_("Giving up attempting to connect after %d try!\n", "Giving up attempting to connect after %d tries!\n", maxTries), maxTries) return False
def connectToView(self): """Attempt to connect to self.vncconnecthost""" maxTries = 10 self.log.info( _("Attempting to connect to vnc client on host %s...") % (self.vncconnecthost, )) if self.vncconnectport != "": hostarg = self.vncconnecthost + ":" + self.vncconnectport else: hostarg = self.vncconnecthost vncconfigcommand = [ self.root + "/usr/bin/vncconfig", "-display", ":%s" % self.display, "-connect", hostarg ] for _i in range(maxTries): vncconfp = subprocess.Popen( vncconfigcommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # vncconfig process err = vncconfp.communicate()[1] if err == '': self.log.info(_("Connected!")) return True elif err.startswith("connecting") and err.endswith("failed\n"): self.log.info(_("Will try to connect again in 15 seconds...")) time.sleep(15) continue else: log.critical(err) sys.exit(1) self.log.error( P_("Giving up attempting to connect after %d try!\n", "Giving up attempting to connect after %d tries!\n", maxTries) % (maxTries, )) return False
def status(self): """ A short string describing the current status of storage setup. """ msg = _("No disks selected") if flags.automatedInstall and not self.storage.root_device: msg = _("Kickstart insufficient") elif self.data.ignoredisk.onlyuse: msg = P_(("%d disk selected"), ("%d disks selected"), len(self.data.ignoredisk.onlyuse)) % len( self.data.ignoredisk.onlyuse) if self.errors: msg = _("Error checking storage configuration") elif self.warnings: msg = _("Warning checking storage configuration") # Maybe show what type of clearpart and which disks selected? elif self.data.autopart.autopart: msg = _("Automatic partitioning selected") else: msg = _("Custom partitioning selected") return msg
def _update_summary(self): count = 0 size = 0 free = 0 for row in self._store: count += 1 size += Size(spec=row[SIZE_COL]) free += Size(spec=row[FREE_SPACE_COL]) size = str(Size(bytes=long(size))).upper() free = str(Size(bytes=long(free))).upper() # pylint: disable-msg=W9922 text = P_( "<b>%(count)d disk; %(size)s capacity; %(free)s free space</b> " "(unpartitioned and in filesystems)", "<b>%(count)d disks; %(size)s capacity; %(free)s free space</b> " "(unpartitioned and in filesystems)", count) % { "count": count, "size": escape_markup(size), "free": escape_markup(free) } self._summary_label.set_markup(text)
def status(self): """ A short string describing the current status of storage setup. """ msg = _("No disks selected") if flags.automatedInstall and not self.storage.rootDevice: msg = _("Kickstart insufficient") elif threadMgr.get(constants.THREAD_DASDFMT): msg = _("Formatting DASDs") elif self.data.ignoredisk.onlyuse: msg = P_(("%d disk selected"), ("%d disks selected"), len(self.data.ignoredisk.onlyuse)) % len( self.data.ignoredisk.onlyuse) if self.errors: msg = _("Error checking storage configuration") elif self.warnings: msg = _("Warning checking storage configuration") elif self.data.autopart.autopart: msg = _("Automatic partitioning selected") else: msg = _("Custom partitioning selected") return msg
def status(self): """ A short string describing the current status of storage setup. """ msg = _("No disks selected") if flags.automatedInstall and not self.storage.rootDevice: return msg elif flags.automatedInstall and not self.data.bootloader.seen: msg = _("No bootloader configured") elif self.data.ignoredisk.onlyuse: msg = P_(("%d disk selected"), ("%d disks selected"), len(self.data.ignoredisk.onlyuse)) % len(self.data.ignoredisk.onlyuse) if self.errors: msg = _("Error checking storage configuration") elif self.warnings: msg = _("Warning checking storage configuration") elif self.data.autopart.autopart: msg = _("Automatic partitioning selected") else: msg = _("Custom partitioning selected") return msg
def _tui_wait(msg, desired_entropy): """Tell user we are waiting for entropy""" print(msg) print(_("Entropy can be increased by typing randomly on keyboard")) print(_("After %d minutes, the installation will continue regardless of the " "amount of available entropy") % (MAX_ENTROPY_WAIT / 60)) fd = sys.stdin.fileno() termios_attrs_changed = False try: old = termios.tcgetattr(fd) new = termios.tcgetattr(fd) new[3] = new[3] & ~termios.ICANON & ~termios.ECHO new[6][termios.VMIN] = 1 termios.tcsetattr(fd, termios.TCSANOW, new) termios_attrs_changed = True except termios.error as term_err: if term_err.args[0] == errno.ENOTTY: # "Inappropriate ioctl for device" --> terminal attributes not supported pass else: raise # wait for the entropy to become high enough or time has run out cur_entr = get_current_entropy() secs = 0 while cur_entr < desired_entropy and secs <= MAX_ENTROPY_WAIT: remaining = (MAX_ENTROPY_WAIT - secs) / 60.0 print(_("Available entropy: %(av_entr)s, Required entropy: %(req_entr)s [%(pct)d %%] (%(rem)d %(min)s remaining)") % {"av_entr": cur_entr, "req_entr": desired_entropy, "pct": int((float(cur_entr) / desired_entropy) * 100), "min": P_("minute", "minutes", remaining), "rem": math.ceil(remaining)}) time.sleep(1) cur_entr = get_current_entropy() secs += 1 # print the final state as well print(_("Available entropy: %(av_entr)s, Required entropy: %(req_entr)s [%(pct)d %%]") % {"av_entr": cur_entr, "req_entr": desired_entropy, "pct": int((float(cur_entr) / desired_entropy) * 100)}) if secs <= MAX_ENTROPY_WAIT: print(_("Enough entropy gathered, please stop typing.")) force_cont = False else: print(_("Giving up, time (%d minutes) ran out.") % (MAX_ENTROPY_WAIT / 60)) force_cont = True # we are done # first let the user notice we are done and stop typing time.sleep(5) # and then just read everything from the input buffer and revert the # termios state data = "have something" while sys.stdin in select.select([sys.stdin], [], [], 0)[0] and data: # just read from stdin and scratch the read data data = sys.stdin.read(1) if termios_attrs_changed: termios.tcsetattr(fd, termios.TCSAFLUSH, old) return force_cont