From: Daniel Hokka Zakrisson Date: Wed, 9 Feb 2011 18:30:58 +0000 (-0500) Subject: Merge branch 'master' of dhozac@git.planet-lab.org:/git/pyplnet X-Git-Tag: pyplnet-4.3-9~1 X-Git-Url: http://git.onelab.eu/?p=pyplnet.git;a=commitdiff_plain;h=04b1025cd00af3ecf4b0a7b49c849ca9e93cf8b9;hp=-c Merge branch 'master' of dhozac@git.planet-lab.org:/git/pyplnet --- 04b1025cd00af3ecf4b0a7b49c849ca9e93cf8b9 diff --combined plnet.py index a99add8,129e5ba..76e1307 --- a/plnet.py +++ b/plnet.py @@@ -1,5 -1,4 +1,4 @@@ #!/usr/bin/python /usr/bin/plcsh - # $Id$ import os import socket @@@ -44,7 -43,7 +43,7 @@@ def InitInterfaces(logger, plc, data, r failedToGetSettings = False # NOTE: GetInterfaces/NodeNetworks does not necessarily order the interfaces - # returned. Because 'interface'is decremented as each interface is processed, + # returned. Because 'interface' is decremented as each interface is processed, # by the time is_primary=True (primary) interface is reached, the device # "eth%s" % interface, is not eth0. But, something like eth-4, or eth-12. # This code sorts the interfaces, placing is_primary=True interfaces first. @@@ -256,7 -255,6 +255,7 @@@ # Process ifcfg-$dev changes / additions newdevs = [] + table = 10 for (dev, details) in devices_map.iteritems(): (fd, tmpnam) = tempfile.mkstemp(dir=sysconfig) f = os.fdopen(fd, "w") @@@ -268,7 -266,7 +267,7 @@@ # print the configuration values for (key, val) in details.iteritems(): if key not in ('IFNAME','ALIAS','CFGOPTIONS','DRIVER','GATEWAY'): - f.write('%s=%s\n' % (key, val)) + f.write('%s="%s"\n' % (key, val)) # print the configuration specific option values (if any) if 'CFGOPTIONS' in details: @@@ -303,7 -301,10 +302,7 @@@ src_route_changed = False if ('PRIMARY' not in details and 'GATEWAY' in details and details['GATEWAY'] != ''): - i = len(dev) - 1 - while dev[i - 1].isdigit(): - i -= 1 - table = 10 + int(dev[i:]) + table += 1 (fd, rule_tmpnam) = tempfile.mkstemp(dir=sysconfig) os.write(fd, "from %s lookup %d\n" % (details['IPADDR'], table)) os.close(fd)