def getNext(self):
        """Tell userchoices what choices were made on this screen.
        
           We don't know bootProto, ip or netmask yet.  They're set in the
           next screen.
        
           You can assign more than one NIC to the COS from scripted install,
           but not from the GUI installer.
        """
        # Case of no NICs found. Driver loading window should prevent this.
        if not self.nicSetup:
            msg = 'No NICs detected'
            MessageWindow(self.thisWindow, msg.title(), msg)
            raise StayOnScreen()

        chosenNics = userchoices.getCosNICs()

        if chosenNics:
            assert len(chosenNics) == 1, "Found more than one console NIC."
            userchoices.delCosNIC(chosenNics[0])

        physicalNic = self.nicSetup.getDevice()
        userchoices.addCosNIC(device=physicalNic,
                              vlanID=self.nicSetup.getVlanID(),
                              bootProto=None,
                              ip=None, netmask=None)
Exemplo n.º 2
0
    def updateCosNic(self):
        "Register COS NIC in userchoices."

        assert 'device' in self.nic, "COS NIC requires device"
        assert 'vlanID' in self.nic, "COS NIC requires VLAN ID"

        currentNics = userchoices.getCosNICs()
        if currentNics:
            # COS NIC was previously defined in userchoices.
            # get rid of existing one.
            assert len(currentNics) == 1, "should have only one COS NIC."
            userchoices.delCosNIC(currentNics[0])
            # Use previously set self.net.
        else:
            # Prior to network config, set as DHCP.
            self.nic['bootProto'] = userchoices.NIC_BOOT_DHCP
            self.nic['ip'] = None
            self.nic['netmask'] = None
            self.net = { 'gateway': None,
                'nameserver1': None, 'nameserver2': None, 'hostname': None }

        userchoices.addCosNIC(self.nic['device'], self.nic['vlanID'],
                              self.nic['bootProto'],
                              self.nic['ip'], self.nic['netmask'])

        self.setSubstepEnv( {'next': self.selectNetConfigMethod } )
Exemplo n.º 3
0
 def updateDHCPMethod(self):
     "update network settings using DHCP"
     userchoices.clearCosNetwork()
     nic_0 = userchoices.getCosNICs()[0]   # get old cosnic
     device, vlanID = nic_0['device'], nic_0['vlanID']
     userchoices.delCosNIC(nic_0)    # delete if exists in userchoices
     bootProto = userchoices.NIC_BOOT_DHCP
     userchoices.addCosNIC(device, vlanID, bootProto)   # add new cosnic
     self.setSubstepEnv( {'next': self.done } )
Exemplo n.º 4
0
    def configureStaticIP(self):
        "do static IP configuration"
        # Retain COS NIC device and VLAN settings, update ip/netmask.
        currentNics = userchoices.getCosNICs()
        assert len(currentNics) == 1, "should have only one COS NIC."
        userchoices.delCosNIC(currentNics[0])
        userchoices.addCosNIC(self.nic['device'], self.nic['vlanID'],
                              self.nic['bootProto'],
                              self.nic['ip'], self.nic['netmask'])

        # Update network params.
        userchoices.setCosNetwork(self.net['gateway'],
                              self.net['nameserver1'], self.net['nameserver2'],
                              self.net['hostname'])

        self.setSubstepEnv( {'next': self.done } )
Exemplo n.º 5
0
                networking.utils.sanityCheckIPSettings(ipSettings["ip"],
                                                       ipSettings["netmask"],
                                                       ipSettings["gateway"])
            except (ValueError, TypeError), msg:
                MessageWindow(self.controlState.gui.getWindow(),
                              "IP Settings Error",
                              str(msg))
                raise StayOnScreen
            userchoices.setCosNetwork(ipSettings["gateway"], ipSettings["ns1"],
                                      ipSettings["ns2"], ipSettings["hostname"])

        #
        # cosnetworkadapter_gui.py has called userchoices.addCosNIC(), but
        # it didn't know what IP or netmask to associate with the chosen NIC.
        # Now that we do know those things, we make that association (and it's
        # just an implementation detail that we do so by deleting and then re-
        # creating the userchoices.__cosNics element rather than editing it in
        # place).
        #
        assert(len(userchoices.getCosNICs()) == 1)
        nic_0 = userchoices.getCosNICs()[0]
        device, vlanID = nic_0['device'], nic_0['vlanID']
        userchoices.delCosNIC(nic_0)
        userchoices.addCosNIC(device, vlanID, bootProto,
                              ipSettings["ip"], ipSettings["netmask"])

    def getNext(self):
        self.saveChoices()
        if userchoices.getActivateNetwork():
            self.activateNetwork(dialogOnSuccess=False)