X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FNodeNetworks.py;h=f63ca23f47422a60b456f821829c8568b1979e79;hb=c3d34f43f41f2aceb6e73dc5d2fc00b9ca96582d;hp=75dddf6792ef831a1ac41c8ec8ce94af1e05f14c;hpb=b7acbd2d6232f77f6a682b1966acd37e61b9b7b3;p=plcapi.git 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]