From 46b2f10d7f2772f711ec2961f19f346f503ea6fc Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Thu, 22 Oct 2015 14:50:54 -0400 Subject: [PATCH] check for VPC subnet ID before using builder VPC This means you can use legacy networking machines by simply changing the instance type and removing the specified 'EC2_VPC_SUBNET_ID' from the executor config. --- buildman/manager/executor.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/buildman/manager/executor.py b/buildman/manager/executor.py index e4f9fb7bb..54b689611 100644 --- a/buildman/manager/executor.py +++ b/buildman/manager/executor.py @@ -121,12 +121,14 @@ class EC2Executor(BuilderExecutor): block_devices = boto.ec2.blockdevicemapping.BlockDeviceMapping() block_devices['/dev/xvda'] = ssd_root_ebs - interface = boto.ec2.networkinterface.NetworkInterfaceSpecification( - subnet_id=self.executor_config['EC2_VPC_SUBNET_ID'], - groups=self.executor_config['EC2_SECURITY_GROUP_IDS'], - associate_public_ip_address=True, - ) - interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface) + interfaces = None + if self.executor_config.get('EC2_VPC_SUBNET_ID', None) is not None: + interface = boto.ec2.networkinterface.NetworkInterfaceSpecification( + subnet_id=self.executor_config['EC2_VPC_SUBNET_ID'], + groups=self.executor_config['EC2_SECURITY_GROUP_IDS'], + associate_public_ip_address=True, + ) + interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface) reservation = yield From(ec2_conn.run_instances( coreos_ami,