Example #1
0
    def getNext(self):
        nfsUrl = self.xml.get_widget('abiquo_nfs_repository').get_text()

        if re.search('(localhost|127\.0\.0\.1)', nfsUrl):
            self.intf.messageWindow("<b>NFS Repository Error</b>",
                       "<b>127.0.0.1 or localhost detected</b>\n\n"
                         "127.0.0.1 or localhost values are not allowed here. "
                         "Use an IP address reachable by other hosts "
                         "in your LAN.",
                            type="warning")
            raise gui.StayOnScreen

        # validate the host
        host = nfsUrl.split(":")[0]
        try:
            network.sanityCheckIPString(host)
        except:
            if network.sanityCheckHostname(host) is not None:
                self.intf.messageWindow("<b>Invalid NFS URL</b>",
                           "NFS Repository URL is invalid.",
                                    type="warning")
                raise gui.StayOnScreen

        if not re.search('.+:\/.*', nfsUrl):
            self.intf.messageWindow("<b>NFS Repository Error</b>",
                         "<b>Invalid NFS URL</b>\n\n"
                         "%s is not a valid NFS URL" % nfsUrl,
                                type="warning")
            raise gui.StayOnScreen

        self.data.abiquo_rs.abiquo_nfs_repository = nfsUrl
Example #2
0
    def getNext(self):
        hostname = string.strip(self.hostnameEntry.get_text())
        herrors = network.sanityCheckHostname(hostname)

        if not hostname:
            self.intf.messageWindow(_("Error with Hostname"),
                                    _("You must enter a valid hostname for this "
                                      "computer."), custom_icon="error")
            self.hostnameError()

        if herrors is not None:
            self.intf.messageWindow(_("Error with Hostname"),
                                    _("The hostname \"%(hostname)s\" is not "
                                      "valid for the following reason:\n\n"
                                      "%(herrors)s")
                                    % {'hostname': hostname,
                                       'herrors': herrors},
                                    custom_icon="error")
            self.hostnameError()

        netif = self.netifCombo.get_model()[self.netifCombo.get_active()][0]
        mode  = self.dhcpCombo.get_model()[self.dhcpCombo.get_active()][0]
        ipaddr = ''
        netmask = ''
        defaultgw = ''
        errors = []
        if mode == "Static":
            ipaddr = self.ipaddr.get_text()
            try:
                network.sanityCheckIPString(ipaddr)
            except network.IPError, e:
                errors.append(e.message)
            except network.IPMissing, e:
                errors.append(e.message)
Example #3
0
    def getNext(self):
        hostname = string.strip(self.hostnameEntry.get_text())
        herrors = network.sanityCheckHostname(hostname)

        if not hostname:
            self.intf.messageWindow(
                _("Error with Hostname"),
                _("You must enter a valid hostname for this "
                  "computer."),
                custom_icon="error")
            self.hostnameError()

        if herrors is not None:
            self.intf.messageWindow(_("Error with Hostname"),
                                    _("The hostname \"%(hostname)s\" is not "
                                      "valid for the following reason:\n\n"
                                      "%(herrors)s") % {
                                          'hostname': hostname,
                                          'herrors': herrors
                                      },
                                    custom_icon="error")
            self.hostnameError()

        self.anaconda.id.network.setHostname(hostname)
        return None
Example #4
0
    def getNext(self):
        hostname = string.strip(self.hostnameEntry.get_text())
        herrors = network.sanityCheckHostname(hostname)

        if not hostname:
            self.intf.messageWindow(_("Error with Hostname"),
                                    _("You must enter a valid hostname for this "
                                      "computer."), custom_icon="error")
            self.hostnameError()

        if herrors is not None:
            self.intf.messageWindow(_("Error with Hostname"),
                                    _("The hostname \"%(hostname)s\" is not "
                                      "valid for the following reason:\n\n"
                                      "%(herrors)s")
                                    % {'hostname': hostname,
                                       'herrors': herrors},
                                    custom_icon="error")
            self.hostnameError()

        self.anaconda.network.hostname = hostname

        self.anaconda.network.useFirewall = self.firewallCb.get_active()

        return None
    def getNext(self):
        nfsUrl = self.xml.get_widget('abiquo_nfs_repository').get_text()
        datacenterId = self.xml.get_widget('datacenterId').get_text()
        nfs_repo_selected = ('abiquo-nfs-repository' in self.anaconda.id.abiquo.selectedGroups)

        if re.search('(localhost|127\.0\.0\.1)', nfsUrl) and not nfs_repo_selected:
            self.intf.messageWindow("<b>NFS Repository Error</b>",
                         "<b>127.0.0.1 or localhost detected</b>\n\n"
                         "127.0.0.1 or localhost values are not allowed here. "
                         "Use an IP address reachable by other hosts "
                         "in your LAN.",
                            type="warning")
            raise gui.StayOnScreen

        serverIP = self.xml.get_widget('abiquo_server_ip').get_text()
        if re.search('(localhost|127\.0\.0\.1)', serverIP):
            self.intf.messageWindow("<b>Abiquo Server IP Error</b>",
                         "<b>127.0.0.1 or localhost detected</b>\n\n"
                         "127.0.0.1 or localhost values are not allowed here. "
                         "Use an IP address reachable by other hosts "
                         "in your LAN.",
                                type="warning")
            raise gui.StayOnScreen

        if not nfs_repo_selected:
            # validate the host
            host = nfsUrl.split(":")[0]
            try:
                network.sanityCheckIPString(host)
            except:
                if network.sanityCheckHostname(host) is not None:
                    self.intf.messageWindow("<b>Invalid NFS URL</b>",
                         "NFS Repository URL is invalid.",
                            type="warning")
                    raise gui.StayOnScreen

        # validate the abiquo server IP
        try:
            socket.inet_aton(serverIP.strip())
        except socket.error:
            self.intf.messageWindow("<b>Abiquo Server IP Error</b>",
                         "Invalid Abiquo Server IP address",
                                type="warning")
            raise gui.StayOnScreen

        if not re.search('.+:\/.*', nfsUrl):
            self.intf.messageWindow("<b>NFS Repository Error</b>",
                         "<b>Invalid NFS URL</b>\n\n"
                         "%s is not a valid NFS URL" % nfsUrl,
                                type="warning")
            raise gui.StayOnScreen


        self.data.abiquo_rs.abiquo_nfs_repository = nfsUrl
        self.data.abiquo_v2v.abiquo_rabbitmq_host = serverIP
        self.data.abiquo_v2v.abiquo_datacenter_id = datacenterId
Example #6
0
    def getNext(self):
        hostname = string.strip(self.hostnameEntry.get_text())
        herrors = network.sanityCheckHostname(hostname)

        if not hostname:
            self.intf.messageWindow(
                _("Error with Hostname"),
                _("You must enter a valid hostname for this "
                  "computer."),
                custom_icon="error")
            self.hostnameError()

        if herrors is not None:
            self.intf.messageWindow(_("Error with Hostname"),
                                    _("The hostname \"%(hostname)s\" is not "
                                      "valid for the following reason:\n\n"
                                      "%(herrors)s") % {
                                          'hostname': hostname,
                                          'herrors': herrors
                                      },
                                    custom_icon="error")
            self.hostnameError()

        netif = self.netifCombo.get_model()[self.netifCombo.get_active()][0]
        mode = self.dhcpCombo.get_model()[self.dhcpCombo.get_active()][0]
        ipaddr = ''
        netmask = ''
        defaultgw = ''
        errors = []
        if mode == "Static":
            ipaddr = self.ipaddr.get_text()
            try:
                network.sanityCheckIPString(ipaddr)
            except network.IPError, e:
                errors.append(e.message)
            except network.IPMissing, e:
                errors.append(e.message)
Example #7
0
    def __call__(self, screen, network, dir, intf):
        devices = network.available ()
        if not devices:
            return INSTALL_NOOP

        # figure out if the hostname is currently manually set
        if anyUsingDHCP(devices):
            if (network.hostname != "localhost.localdomain" and
                network.overrideDHCPhostname):
                manual = 1
            else:
                manual = 0
        else:
            manual = 1

        thegrid = Grid(2, 2)
        radio = RadioGroup()
        autoCb = radio.add(_("automatically via DHCP"), "dhcp",
                                not manual)
        thegrid.setField(autoCb, 0, 0, growx = 1, anchorLeft = 1)

        manualCb = radio.add(_("manually"), "manual", manual)
        thegrid.setField(manualCb, 0, 1, anchorLeft = 1)
        hostEntry = Entry(24)
        if network.hostname != "localhost.localdomain":
            hostEntry.set(network.hostname)
        thegrid.setField(hostEntry, 1, 1, padding = (1, 0, 0, 0),
                         anchorLeft = 1)            

        # disable the dhcp if we don't have any dhcp
        if anyUsingDHCP(devices):
            autoCb.w.checkboxSetFlags(FLAG_DISABLED, FLAGS_RESET)            
        else:
            autoCb.w.checkboxSetFlags(FLAG_DISABLED, FLAGS_SET)

        self.hostTypeCb((radio, hostEntry))

        autoCb.setCallback(self.hostTypeCb, (radio, hostEntry))
        manualCb.setCallback(self.hostTypeCb, (radio, hostEntry))

        toplevel = GridFormHelp(screen, _("Hostname Configuration"),
                                "hostname", 1, 4)
        text = TextboxReflowed(55,
                               _("If your system is part of a larger network "
                                 "where hostnames are assigned by DHCP, "
                                 "select automatically via DHCP. Otherwise, "
                                 "select manually and enter in a hostname for "
                                 "your system. If you do not, your system "
                                 "will be known as 'localhost.'"))
        toplevel.add(text, 0, 0, (0, 0, 0, 1))

        bb = ButtonBar(screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON))
        toplevel.add(thegrid, 0, 1, padding = (0, 0, 0, 1))
        toplevel.add(bb, 0, 2, growx = 1)

        while 1:
            result = toplevel.run()
            rc = bb.buttonPressed(result)
            
            if rc == TEXT_BACK_CHECK:
                screen.popWindow()
                return INSTALL_BACK

            if radio.getSelection() != "manual":
                network.overrideDHCPhostname = 0
                network.hostname = "localhost.localdomain"
            else:
                hname = string.strip(hostEntry.value())
                if len(hname) == 0:
                    ButtonChoiceWindow(screen, _("Invalid Hostname"),
                                       _("You have not specified a hostname."),
                                       buttons = [ _("OK") ])
                    continue
                neterrors = sanityCheckHostname(hname)
                if neterrors is not None:
                    ButtonChoiceWindow(screen, _("Invalid Hostname"),
                                       _("The hostname \"%s\" is not valid "
                                         "for the following reason:\n\n%s")
                                       %(hname, neterrors),
                                       buttons = [ _("OK") ])
                    continue

                network.overrideDHCPhostname = 1
                network.hostname = hname
            break

        screen.popWindow()
        return INSTALL_OK