X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net.py;h=9fb4bce34e772875ebe777c79d0f4ec024a65355;hb=1170627c76832513faf152af5bf1d4ffaf588c02;hp=394c9d7542430648b9d2b6a440094f858ff632c6;hpb=4035f3528ab1fe33370186cd37ee12f37c068101;p=nodemanager.git diff --git a/net.py b/net.py index 394c9d7..9fb4bce 100644 --- a/net.py +++ b/net.py @@ -17,6 +17,8 @@ def GetSlivers(plc, data): InitNAT(plc, data) def InitNodeLimit(data): + if not 'networks' in data: return + # query running network interfaces devs = sioc.gifconf() ips = dict(zip(devs.values(), devs.keys())) @@ -60,6 +62,8 @@ def InitNodeLimit(data): # again, or vice-versa. def InitI2(plc, data): + if not 'groups' in data: return + if "Internet2" in data['groups']: logger.log("This is an Internet2 node. Setting rules.") i2nodes = [] @@ -83,6 +87,8 @@ def InitI2(plc, data): os.popen("/sbin/iptables -t mangle " + cmd) def InitNAT(plc, data): + if not 'networks' in data: return + # query running network interfaces devs = sioc.gifconf() ips = dict(zip(devs.values(), devs.keys())) @@ -131,6 +137,8 @@ def InitNAT(plc, data): ipt.commit() def InitInterfaces(plc, data): + if not 'networks' in data: return + sysconfig = "/etc/sysconfig/network-scripts" # query running network interfaces @@ -144,7 +152,7 @@ def InitInterfaces(plc, data): interfaces = {} interface = 1 hostname = data.get('hostname',socket.gethostname()) - networks = data.get('networks',()) + networks = data['networks'] failedToGetSettings = False for network in networks: logger.log('interface %d: %s'%(interface,network))