in dhcpbridge, only grab network id from env if needed

This commit is contained in:
Dan Wendlandt
2011-08-17 22:29:04 -07:00
parent 9538e313b4
commit 8ce5f15484

View File

@@ -99,8 +99,6 @@ def main():
utils.default_flagfile(flagfile) utils.default_flagfile(flagfile)
argv = FLAGS(sys.argv) argv = FLAGS(sys.argv)
logging.setup() logging.setup()
# check ENV first so we don't break any older deploys
network_id = int(os.environ.get('NETWORK_ID'))
if int(os.environ.get('TESTING', '0')): if int(os.environ.get('TESTING', '0')):
from nova.tests import fake_flags from nova.tests import fake_flags
@@ -115,11 +113,11 @@ def main():
if action in ['add', 'del', 'old']: if action in ['add', 'del', 'old']:
mac = argv[2] mac = argv[2]
ip = argv[3] ip = argv[3]
msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s" msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s") % locals()
" for network %(network_id)s") % locals()
LOG.debug(msg) LOG.debug(msg)
globals()[action + '_lease'](mac, ip) globals()[action + '_lease'](mac, ip)
else: else:
network_id = int(os.environ.get('NETWORK_ID'))
print init_leases(network_id) print init_leases(network_id)
if __name__ == "__main__": if __name__ == "__main__":