def initialize(self): """Here is were all the relative vars get initialized. """ # Network may be slow. Try for 5 seconds tries = 5 while tries: self.ip = network.get_default_device_ip( ) or network.getFirstRealIP() if self.ip: break time.sleep(1) tries -= 1 if not self.ip: return if self.ip.find(':') != -1: ipstr = "[%s]" % (self.ip, ) else: ipstr = self.ip try: hinfo = socket.gethostbyaddr(self.ip) if len(hinfo) == 3: # Consider as coming from a valid DNS record only if single IP is returned if len(hinfo[2]) == 1: self.name = hinfo[0] except socket.herror as e: log.debug("Exception caught trying to get host name of %s: %s", ipstr, e) if self.name is not None and not self.name.startswith('localhost'): self.connxinfo = "%s:%s (%s:%s)" % \ (socket.getfqdn(name=self.name), constants.X_DISPLAY_NUMBER, ipstr, constants.X_DISPLAY_NUMBER) host = self.name elif ipstr is not None: self.connxinfo = "%s:%s" % (ipstr, constants.X_DISPLAY_NUMBER) host = ipstr else: self.connxinfo = None host = "" # figure out product info if host: self.desktop = _("%(productName)s %(productVersion)s installation " "on host %(name)s") \ % {'productName': product.productName, 'productVersion': product.productVersion, 'name': host}
def initialize(self): """Here is were all the relative vars get initialized. """ # Network may be slow. Try for 5 seconds tries = 5 while tries: self.ip = network.getFirstRealIP() if self.ip: break time.sleep(1) tries -= 1 if not self.ip: return if self.ip.find(':') != -1: ipstr = "[%s]" % (self.ip,) else: ipstr = self.ip try: hinfo = socket.gethostbyaddr(self.ip) if len(hinfo) == 3: # Consider as coming from a valid DNS record only if single IP is returned if len(hinfo[2]) == 1: self.name = hinfo[0] except socket.herror as e: log.debug("Exception caught trying to get host name of %s: %s", ipstr, e) if self.name is not None and not self.name.startswith('localhost'): self.connxinfo = "%s:%s (%s:%s)" % (socket.getfqdn(name=self.name), constants.X_DISPLAY_NUMBER, ipstr, constants.X_DISPLAY_NUMBER) host = self.name elif ipstr is not None: self.connxinfo = "%s:%s" % (ipstr, constants.X_DISPLAY_NUMBER) host = ipstr else: self.connxinfo = None host = "" # figure out product info if host: self.desktop = _("%(productName)s %(productVersion)s installation " "on host %(name)s") \ % {'productName': product.productName, 'productVersion': product.productVersion, 'name': host}
def initialize(self): """Here is were all the relative vars get initialized. """ # Network may be slow. Try for 5 seconds tries = 5 while tries: self.ip = network.getFirstRealIP() if self.ip: break time.sleep(1) tries -= 1 if not self.ip: return ipstr = self.ip try: hinfo = socket.gethostbyaddr(ipstr) except socket.herror as e: log.debug("Exception caught trying to get host name of %s: %s", ipstr, e) self.name = network.getHostname() else: if len(hinfo) == 3: self.name = hinfo[0] if self.ip.find(':') != -1: ipstr = "[%s]" % (self.ip, ) if (self.name is not None) and ( not self.name.startswith('localhost')) and (ipstr is not None): self.connxinfo = "%s:%s (%s:%s)" % (socket.getfqdn( name=self.name), self.display, ipstr, self.display) elif ipstr is not None: self.connxinfo = "%s:%s" % ( ipstr, self.display, ) else: self.connxinfo = None # figure out product info if self.name is not None: self.desktop = _("%(productName)s %(productVersion)s installation " "on host %(name)s") \ % {'productName': product.productName, 'productVersion': product.productVersion, 'name': self.name}
def prompt_for_ssh(): """Prompt the user to ssh to the installation environment on the s390.""" # Do some work here to get the ip addr / hostname to pass # to the user. import socket ip = network.getFirstRealIP() if not ip: stdout_log.error( "No IP addresses found, cannot continue installation.") iutil.ipmi_report(constants.IPMI_ABORTED) sys.exit(1) ipstr = ip try: hinfo = socket.gethostbyaddr(ipstr) except socket.herror as e: stdout_log.debug("Exception caught trying to get host name of %s: %s", ipstr, e) name = network.getHostname() else: if len(hinfo) == 3: name = hinfo[0] if ip.find(':') != -1: ipstr = "[%s]" % (ip, ) if (name is not None) and (not name.startswith('localhost')) and ( ipstr is not None): connxinfo = "%s (%s)" % ( socket.getfqdn(name=name), ipstr, ) elif ipstr is not None: connxinfo = "%s" % (ipstr, ) else: connxinfo = None if connxinfo: stdout_log.info(_("Please ssh install@%s to begin the install."), connxinfo) else: stdout_log.info( _("Please ssh install@HOSTNAME to continue installation."))
def initialize(self): """Here is were all the relative vars get initialized. """ # Network may be slow. Try for 5 seconds tries = 5 while tries: self.ip = network.getFirstRealIP() if self.ip: break time.sleep(1) tries -= 1 if not self.ip: return ipstr = self.ip try: hinfo = socket.gethostbyaddr(ipstr) except socket.herror as e: log.debug("Exception caught trying to get host name of %s: %s", ipstr, e) self.name = network.getHostname() else: if len(hinfo) == 3: self.name = hinfo[0] if self.ip.find(':') != -1: ipstr = "[%s]" % (self.ip,) name_ips = [i[4][0] for i in socket.getaddrinfo(self.name, 0)] if self.name is not None and not self.name.startswith('localhost') \ and ipstr is not None and self.ip in name_ips: self.connxinfo = "%s:%s (%s:%s)" % \ (socket.getfqdn(name=self.name), constants.X_DISPLAY_NUMBER, ipstr, constants.X_DISPLAY_NUMBER) elif ipstr is not None: self.connxinfo = "%s:%s" % (ipstr, constants.X_DISPLAY_NUMBER) else: self.connxinfo = None # figure out product info if self.name is not None: self.desktop = _("%(productName)s %(productVersion)s installation " "on host %(name)s") \ % {'productName': product.productName, 'productVersion': product.productVersion, 'name': self.name}
def initialize(self): """Here is were all the relative vars get initialized. """ # Network may be slow. Try for 5 seconds tries = 5 while tries: self.ip = network.getFirstRealIP() if self.ip: break time.sleep(1) tries -= 1 if not self.ip: return ipstr = self.ip try: hinfo = socket.gethostbyaddr(ipstr) except socket.herror as e: log.debug("Exception caught trying to get host name of %s: %s", ipstr, e) self.name = network.getHostname() else: if len(hinfo) == 3: self.name = hinfo[0] if self.ip.find(":") != -1: ipstr = "[%s]" % (self.ip,) if (self.name is not None) and (not self.name.startswith("localhost")) and (ipstr is not None): self.connxinfo = "%s:%s (%s:%s)" % (socket.getfqdn(name=self.name), self.display, ipstr, self.display) elif ipstr is not None: self.connxinfo = "%s:%s" % (ipstr, self.display) else: self.connxinfo = None # figure out product info if self.name is not None: self.desktop = _("%(productName)s %(productVersion)s installation " "on host %(name)s") % { "productName": product.productName, "productVersion": product.productVersion, "name": self.name, }
def prompt_for_ssh(): """Prompt the user to ssh to the installation environment on the s390.""" # Do some work here to get the ip addr / hostname to pass # to the user. import socket ip = network.getFirstRealIP() if not ip: stdout_log.error("No IP addresses found, cannot continue installation.") iutil.ipmi_report(constants.IPMI_ABORTED) sys.exit(1) ipstr = ip try: hinfo = socket.gethostbyaddr(ipstr) except socket.herror as e: stdout_log.debug("Exception caught trying to get host name of %s: %s", ipstr, e) name = network.getHostname() else: if len(hinfo) == 3: name = hinfo[0] if ip.find(':') != -1: ipstr = "[%s]" % (ip,) if (name is not None) and (not name.startswith('localhost')) and (ipstr is not None): connxinfo = "%s (%s)" % (socket.getfqdn(name=name), ipstr,) elif ipstr is not None: connxinfo = "%s" % (ipstr,) else: connxinfo = None if connxinfo: stdout_log.info(_("Please ssh install@%s to begin the install."), connxinfo) else: stdout_log.info(_("Please ssh install@HOSTNAME to continue installation."))