X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FInterfaces.py;h=8e5d4b68ec3f6cb81e1341236e48f3fdfcd11627;hb=b9b8ba17171d7d5abe9eb6d8008a1e7e94153ba5;hp=c8ccd2ecc8a7b78f8dd6a593067150c56e6a8876;hpb=0c28b6c095054293cc35c75a7a601486a4c249ff;p=plcapi.git diff --git a/PLC/Interfaces.py b/PLC/Interfaces.py index c8ccd2e..8e5d4b6 100644 --- a/PLC/Interfaces.py +++ b/PLC/Interfaces.py @@ -184,10 +184,11 @@ class Interface(Row): # DHCP! elif method == "static": - 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]: + for key in ['gateway', 'dns1']: + if key not in self or not self[key]: + if 'is_primary' in self and self['is_primary'] is True: raise PLCInvalidArgument, "For static method primary network, %s is required" % key + else: globals()[key] = self[key] for key in ['ip', 'network', 'broadcast', 'netmask']: if key not in self or not self[key]: