mypy: For EC2, Ensure to_configure is passed a not-None argument.

This commit is contained in:
neiljp (Neil Pilgrim) 2017-07-09 14:05:48 -07:00 committed by Tim Abbott
parent ba51958c40
commit 8cabce9f5e
1 changed files with 4 additions and 2 deletions

View File

@ -105,7 +105,9 @@ for device in macs.values():
# HACK: It appears on Xenial device_number in the data set is 0 but in reality it is 3 # HACK: It appears on Xenial device_number in the data set is 0 but in reality it is 3
device_number += 3 device_number += 3
if address_of(device_number) is None: address = address_of(device_number)
if address is None:
# If the device was not autoconfigured, do so now. # If the device was not autoconfigured, do so now.
log.info("Device ens%i not configured, starting dhcpd" % (device_number,)) log.info("Device ens%i not configured, starting dhcpd" % (device_number,))
subprocess.check_call(['/sbin/dhcpcd', 'ens%i' % device_number]) subprocess.check_call(['/sbin/dhcpcd', 'ens%i' % device_number])
@ -127,7 +129,7 @@ for device in macs.values():
['/sbin/iptables', '-t', 'mangle', '-A', 'OUTPUT', '-m', 'conntrack', '--ctorigdst', ['/sbin/iptables', '-t', 'mangle', '-A', 'OUTPUT', '-m', 'conntrack', '--ctorigdst',
address, '-j', 'MARK', '--set-mark', dev_num]) address, '-j', 'MARK', '--set-mark', dev_num])
to_configure.remove(address_of(device_number)) to_configure.remove(address)
for (count, ip) in enumerate(to_configure): for (count, ip) in enumerate(to_configure):
# Configure the IP via a virtual interface # Configure the IP via a virtual interface