Ejemplo n.º 1
0
    def getScreen(self, anaconda):
        self.intf = anaconda.intf
        self.anaconda = anaconda
        self.hostname = network.getDefaultHostname(anaconda)

        # load the UI
        (self.xml, self.align) = gui.getGladeWidget("network.glade",
                                                    "network_align")
        self.icon = self.xml.get_widget("icon")
        self.hostnameEntry = self.xml.get_widget("hostnameEntry")
        self.hostnameEntry.set_text(self.hostname)

        self.netconfButton = self.xml.get_widget("netconfButton")
        self.netconfButton.connect("clicked", self._setupNetwork)
        if len(self.anaconda.id.network.netdevices) == 0:
            self.netconfButton.set_sensitive(False)

        # pressing Enter in confirm == clicking Next
        self.hostnameEntry.connect("activate",
                                   lambda w: self.ics.setGrabNext(1))

        # load the icon
        gui.readImageFromFile("network.png", image=self.icon)

        return self.align
Ejemplo n.º 2
0
    def getScreen(self, anaconda):
        self.intf = anaconda.intf
        self.anaconda = anaconda
        self.hostname = network.getDefaultHostname(anaconda)

        # load the UI
        (self.xml, self.align) = gui.getGladeWidget("network.glade",
                                                    "network_align")
        self.icon = self.xml.get_widget("icon")
        self.hostnameEntry = self.xml.get_widget("hostnameEntry")
        self.hostnameEntry.set_text(self.hostname)

        # pressing Enter in confirm == clicking Next
        self.hostnameEntry.connect("activate",
                                   lambda w: self.ics.setGrabNext(1))

        # load the icon
        gui.readImageFromFile("network.png", image=self.icon)

        self.firewallCb = self.xml.get_widget("firewall_check")
        self.firewallCb.set_active(self.anaconda.network.useFirewall)
        from sabayon import Entropy
        from sabayon.const import FIREWALL_PACKAGE
        if not Entropy().is_installed(FIREWALL_PACKAGE):
            self.firewallCb.set_visible(False)

        return self.align
Ejemplo n.º 3
0
    def getScreen(self, anaconda):
        self.intf = anaconda.intf
        self.anaconda = anaconda
        self.hostname = network.getDefaultHostname(anaconda)

        # load the UI
        (self.xml, self.align) = gui.getGladeWidget("network.glade",
                                                    "network_align")
        self.icon = self.xml.get_widget("icon")
        self.hostnameEntry = self.xml.get_widget("hostnameEntry")
        self.hostnameEntry.set_text(self.hostname)

        self.netconfButton = self.xml.get_widget("netconfButton")
        self.netconfButton.connect("clicked", self._netconfButton_clicked)
        if len(self.anaconda.id.network.netdevices) == 0:
            self.netconfButton.set_sensitive(False)

        # pressing Enter in confirm == clicking Next
        self.hostnameEntry.connect("activate",
                                   lambda w: self.ics.setGrabNext(1))

        # load the icon
        gui.readImageFromFile("network.png", image=self.icon)

        return self.align
Ejemplo n.º 4
0
    def initialize(self):
        """Here is were all the relative vars get initialized. """

        # see if we can sniff out network info
        netinfo = network.Network()

        devices = netinfo.netdevices
        active_devs = network.getActiveNetDevs()

        self.ip = None
        if active_devs != []:
            devname = devices[active_devs[0]].iface
            try:
                ips = (isys.getIPAddresses(devname, version=4) +
                       isys.getIPAddresses(devname, version=6))
            except Exception as e:
                log.warning("Got an exception trying to get the self.ip addr "
                            "of %s: %s" % (devname, e))
            else:
                if ips and ips[0] not in ("127.0.0.1", "::1"):
                    log.info("IPs (using first) of device %s: %s" % (devname,
                                                                     ips))
                    self.ip = ips[0]

        ipstr = self.ip

        try:
            hinfo = socket.gethostbyaddr(ipstr)
        except Exception as e:
            log.debug("Exception caught trying to get host name of %s: %s" %
                      (ipstr, e))
            self.name = network.getDefaultHostname(self.anaconda)
        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)" % (socket.getfqdn(name=self.name), self.display, ipstr,)
        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}
        else:
            self.desktop = _("%(productName)s %(productVersion)s installation")\
                           % {'productName': product.productName,
                              'productVersion': product.productVersion}
Ejemplo n.º 5
0
    def getScreen(self, anaconda):
        self.intf = anaconda.intf
        self.anaconda = anaconda
        self.hostname = network.getDefaultHostname(anaconda)

        # load the UI
        (self.xml, self.align) = gui.getGladeWidget("network_euca.glade",
                                                    "network_align")
        self.icon = self.xml.get_widget("icon")
        self.hostnameEntry = self.xml.get_widget("hostnameEntry")
        self.hostnameEntry.set_text(self.hostname)

        self.netconfButton = self.xml.get_widget("netconfButton")
        self.netconfButton.connect("clicked", self._netconfButton_clicked)
        if len(self.anaconda.id.network.netdevices) == 0:
            self.netconfButton.set_sensitive(False)

        # pressing Enter in confirm == clicking Next
        self.hostnameEntry.connect("activate",
                                   lambda w: self.ics.setGrabNext(1))

        self.netifCombo = self.xml.get_widget("netifcombo")
        cell = gtk.CellRendererText()
        self.ipaddr = self.xml.get_widget("ipaddr")
        self.netmask = self.xml.get_widget("netmask")
        self.defaultgw = self.xml.get_widget("defaultgw")
        self.netifCombo.set_model(gtk.ListStore(gobject.TYPE_STRING))
        self.netifCombo.pack_start(cell)
        self.netifCombo.add_attribute(cell, 'text', 0)
        for dev in anaconda.id.network.netdevices.keys():
            self.netifCombo.append_text(dev)
        self.netifCombo.set_active(0)
        self.netifCombo.connect("changed", self._netifCombo_changed)
        self.dhcpCombo = self.xml.get_widget("dhcpcombo")
        self.dhcpCombo.connect("changed", self._dhcpCombo_changed)

        self.dnsserver = self.xml.get_widget("dnsserver")

        # load current network settings
        self._netifCombo_changed()

        # Only reset to Static mode when we are going forward.
        # A little hacky, but good enough for now.
        if anaconda.dir == DISPATCH_FORWARD:
            self.dhcpCombo.set_active(0)
            self._dhcpCombo_changed()
 
        # load the icon
        gui.readImageFromFile("network.png", image=self.icon)

        return self.align
Ejemplo n.º 6
0
    def getScreen(self, anaconda):
        self.intf = anaconda.intf
        self.anaconda = anaconda
        self.hostname = network.getDefaultHostname(anaconda)

        # load the UI
        (self.xml, self.align) = gui.getGladeWidget("network_euca.glade",
                                                    "network_align")
        self.icon = self.xml.get_widget("icon")
        self.hostnameEntry = self.xml.get_widget("hostnameEntry")
        self.hostnameEntry.set_text(self.hostname)

        self.netconfButton = self.xml.get_widget("netconfButton")
        self.netconfButton.connect("clicked", self._netconfButton_clicked)
        if len(self.anaconda.id.network.netdevices) == 0:
            self.netconfButton.set_sensitive(False)

        # pressing Enter in confirm == clicking Next
        self.hostnameEntry.connect("activate",
                                   lambda w: self.ics.setGrabNext(1))

        self.netifCombo = self.xml.get_widget("netifcombo")
        cell = gtk.CellRendererText()
        self.ipaddr = self.xml.get_widget("ipaddr")
        self.netmask = self.xml.get_widget("netmask")
        self.defaultgw = self.xml.get_widget("defaultgw")
        self.netifCombo.set_model(gtk.ListStore(gobject.TYPE_STRING))
        self.netifCombo.pack_start(cell)
        self.netifCombo.add_attribute(cell, 'text', 0)
        for dev in anaconda.id.network.netdevices.keys():
            self.netifCombo.append_text(dev)
        self.netifCombo.set_active(0)
        self.netifCombo.connect("changed", self._netifCombo_changed)
        self.dhcpCombo = self.xml.get_widget("dhcpcombo")
        self.dhcpCombo.connect("changed", self._dhcpCombo_changed)

        self.dnsserver = self.xml.get_widget("dnsserver")

        # load current network settings
        self._netifCombo_changed()

        # Only reset to Static mode when we are going forward.
        # A little hacky, but good enough for now.
        if anaconda.dir == DISPATCH_FORWARD:
            self.dhcpCombo.set_active(0)
            self._dhcpCombo_changed()

        # load the icon
        gui.readImageFromFile("network.png", image=self.icon)

        return self.align
Ejemplo n.º 7
0
 def __call__(self, screen, anaconda):
     hname = network.getDefaultHostname(anaconda)
     anaconda.id.network.hostname = hname
     return INSTALL_OK
Ejemplo n.º 8
0
            try:
                devname = dev.iface
                ips = (isys.getIPAddresses(devname, version=4) +
                       isys.getIPAddresses(devname, version=6))
                self.ip = ips[0]
                log.info("IPs (using first) of device %s: %s" % (devname, ips))

                if self.ip == "127.0.0.1" or self.ip == "::1":
                    self.ip = None
            except Exception, e:
                log.warning("Got an exception trying to get the self.ip addr "
                            "of %s: %s" % (devname, e))
        else:
            self.ip = None

        self.name = network.getDefaultHostname(self.anaconda)
        ipstr = self.ip

        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)" % (
                socket.getfqdn(name=self.name),
                self.display,
                ipstr,
            )
        elif ipstr is not None:
            self.connxinfo = "%s:%s" % (
                ipstr,
Ejemplo n.º 9
0
 def __call__(self, screen, anaconda):
     if anaconda.dispatch.dir == DISPATCH_BACK:
         return INSTALL_BACK
     hname = network.getDefaultHostname(anaconda)
     anaconda.id.network.hostname = hname
     return INSTALL_OK
Ejemplo n.º 10
0
        if active_devs != []:
            dev = devices[active_devs[0]]

            try:
                self.ip = isys.getIPAddress(dev.get("DEVICE"))
                log.info("ip of %s is %s" % (dev.get("DEVICE"), self.ip))

                if self.ip == "127.0.0.1" or self.ip == "::1":
                    self.ip = None
            except Exception, e:
                log.warning("Got an exception trying to get the self.ip addr "
                            "of %s: %s" % (dev.get("DEVICE"), e))
        else:
            self.ip = None

        self.name = network.getDefaultHostname(self.anaconda)
        ipstr = self.ip

        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)" % (socket.getfqdn(name=self.name), self.display, ipstr,)
        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 "
Ejemplo n.º 11
0
 def __call__(self, screen, anaconda):
     if anaconda.dispatch.dir == DISPATCH_BACK:
         return INSTALL_BACK
     hname = network.getDefaultHostname(anaconda)
     anaconda.id.network.hostname = hname
     return INSTALL_OK
Ejemplo n.º 12
0
 def __call__(self, screen, anaconda):
     hname = network.getDefaultHostname(anaconda)
     anaconda.network.hostname = hname
     return INSTALL_OK