From c3d34f43f41f2aceb6e73dc5d2fc00b9ca96582d Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Tue, 27 Nov 2007 22:05:24 +0000 Subject: [PATCH] Make DNS optional as well for non-primary static networks. --- PLC/NodeNetworks.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PLC/NodeNetworks.py b/PLC/NodeNetworks.py index 75dddf6..f63ca23 100644 --- a/PLC/NodeNetworks.py +++ b/PLC/NodeNetworks.py @@ -182,10 +182,12 @@ class NodeNetwork(Row): # DHCP! elif method == "static": - if 'gateway' not in self or self['gateway'] is None: - if 'is_primary' in self and self['is_primary'] is True: - raise PLCInvalidArgument, "For static method primary network, gateway is required" - for key in ['ip', 'network', 'broadcast', 'netmask', 'dns1']: + if 'is_primary' in self and self['is_primary'] is True: + for key in ['gateway', 'dns1']: + if key not in self or not self[key]: + raise PLCInvalidArgument, "For static method primary network, %s is required" % key + globals()[key] = self[key] + for key in ['ip', 'network', 'broadcast', 'netmask']: if key not in self or not self[key]: raise PLCInvalidArgument, "For static method, %s is required" % key globals()[key] = self[key] -- 2.43.0