diff --git a/puppet/zulip_internal/files/zulip-ec2-configure-interfaces b/puppet/zulip_internal/files/zulip-ec2-configure-interfaces index 4f9f7e3218..18e0e8fc8e 100755 --- a/puppet/zulip_internal/files/zulip-ec2-configure-interfaces +++ b/puppet/zulip_internal/files/zulip-ec2-configure-interfaces @@ -1,5 +1,28 @@ #!/usr/bin/python # -*- coding: utf-8 -*- +# +# Copyright © 2013 Zulip, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Original author: Luke Faraone + '''Configure a host for EC2-VPC dynamically assigned network interfaces Amazon VPC gives us a good deal of flexibility compared to classic EC2. @@ -40,12 +63,12 @@ def guess_gateway(device_id): address[3] = '1' return '.'.join(address) -log = logging.getLogger('ec2ify') +log = logging.getLogger('configure-cloud-interfaces') log.setLevel(logging.DEBUG) log.addHandler(logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON)) log.addHandler(logging.StreamHandler()) -log.info("ec2ify starting") +log.info("Starting.") macs = boto.utils.get_instance_metadata()["network"]["interfaces"]["macs"] ids = [int(macdata['device-number']) for macdata in macs.values()] @@ -84,6 +107,7 @@ for device in macs.values(): ['/sbin/iptables', '-t', 'mangle', '-A', 'OUTPUT', '-m', 'conntrack', '--ctorigdst', address_of(device_number), '-j', 'MARK', '--set-mark', str(device_number)]) + to_configure.remove(address_of(device_number)) for (count, ip) in enumerate(to_configure): @@ -99,3 +123,5 @@ for device in macs.values(): # Don't freak out if this doens't work. subprocess.call( ['/sbin/ip', 'route', 'del', '10.0.0.0/8']) + +log.info("Finished.")