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 } )
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"])