Currently networking coming up happens independent of cloud-init. We could potentially make cloud-init local block networking from coming up, but I don't think thats something I'd want to take on for cloud-init 0.7.3 / Ubuntu 13.10.
I'm not really sure how much a hack this is, if at all.
The solution I'd propose would be:
* use 'ifquery' to get the list of networking interfaces in the original
from cloudinit import util
(out, _err) = util.subp(['ifquery', '--list', '--allow', 'auto'])
orig_list = out.splitlines()
* use ifquery to get the list of 'auto' interfaces in your new list:
(out, _err) = util.subp(['ifquery', '--interfaces=/tmp/my.tmp.interfaces', --list', '--allow', 'auto'])
new_list = out.splitlines()
* take down interfaces in orig_list and new_list
for iface in [i for i in orig_list if i in new_list]:
util.subp(['ifdown', iface]
# have to ignore errors above in case the interface wasn't up.
* write/update /etc/network/interfaces file
* bring all interfaces up:
util.subp(['ifup', '-a'])
Currently networking coming up happens independent of cloud-init. We could potentially make cloud-init local block networking from coming up, but I don't think thats something I'd want to take on for cloud-init 0.7.3 / Ubuntu 13.10.
I'm not really sure how much a hack this is, if at all. ['ifquery' , '--list', '--allow', 'auto'])
The solution I'd propose would be:
* use 'ifquery' to get the list of networking interfaces in the original
from cloudinit import util
(out, _err) = util.subp(
orig_list = out.splitlines()
* use ifquery to get the list of 'auto' interfaces in your new list: ['ifquery' , '--interfaces= /tmp/my. tmp.interfaces' ,
--list' , '--allow', 'auto'])
(out, _err) = util.subp(
new_list = out.splitlines()
* take down interfaces in orig_list and new_list subp([' ifdown' , iface]
for iface in [i for i in orig_list if i in new_list]:
util.
# have to ignore errors above in case the interface wasn't up.
* write/update /etc/network/ interfaces file
* bring all interfaces up: subp([' ifup', '-a'])
util.
I opened bug 1226067 (http:// pad.lv/ 1226067) to address an issue where
ifquery is busted in saucy, but that will get fixed.