Ejemplo n.º 1
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 } )
Ejemplo n.º 2
0
 def saveChoices(self):
     if self.networkAddressWidgets.getUsingDHCP():
         bootProto = userchoices.NIC_BOOT_DHCP
         ipSettings = self.networkAddressWidgets.testIPSettings([])
         userchoices.clearCosNetwork()
     else:
         bootProto = userchoices.NIC_BOOT_STATIC
         tests = ["ip", "netmask", "gateway", "ns1", "ns2", "hostname"]
         ipSettings = self.networkAddressWidgets.testIPSettings(tests)
         try:
             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"])