Created
May 16, 2011 11:56
-
-
Save zuriby/974319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
from amsutils import common, confighelpers | |
from amsutils.common import shell | |
from amsutils.confighelpers import get_meta_config | |
lines = [ | |
# take the bridge down | |
"ifconfig afik_br down", | |
"brctl delbr afik_br", | |
# recreate bridge | |
"brctl addbr afik_br", | |
"brctl addif afik_br eth0", | |
"brctl addif afik_tap", | |
# bring up interfaces | |
"ifconfig afik_br up", | |
"ifconfig eth0 up", | |
] | |
for iface in get_meta_config()['ams_ifaces']: | |
lines.append("ip addr add %(address)s brd + dev %(name)s" % iface) | |
if iface.get("gateway", None): | |
lines.append("route add default gw %(gateway)s dev %(name)s" % iface) | |
lines.append("amslocal start") | |
map(shell, lines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment