EC2 flake8 fixes.
This commit is contained in:
parent
8bc8f09b47
commit
8ba308bf07
@ -6,7 +6,6 @@ from datetime import datetime
|
||||
import itertools
|
||||
import re
|
||||
|
||||
import six
|
||||
import boto
|
||||
from boto.ec2.instance import Instance as BotoInstance, Reservation
|
||||
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
|
||||
@ -103,6 +102,7 @@ class InstanceState(object):
|
||||
self.name = name
|
||||
self.code = code
|
||||
|
||||
|
||||
class StateReason(object):
|
||||
def __init__(self, message="", code=""):
|
||||
self.message = message
|
||||
@ -319,9 +319,9 @@ class Instance(BotoInstance, TaggedEC2Resource):
|
||||
self.vpc_id = subnet.vpc_id
|
||||
|
||||
self.prep_nics(kwargs.get("nics", {}),
|
||||
subnet_id=kwargs.get("subnet_id",None),
|
||||
private_ip=kwargs.get("private_ip",None),
|
||||
associate_public_ip=kwargs.get("associate_public_ip",None))
|
||||
subnet_id=kwargs.get("subnet_id"),
|
||||
private_ip=kwargs.get("private_ip"),
|
||||
associate_public_ip=kwargs.get("associate_public_ip"))
|
||||
|
||||
@classmethod
|
||||
def create_from_cloudformation_json(cls, resource_name, cloudformation_json):
|
||||
@ -411,12 +411,9 @@ class Instance(BotoInstance, TaggedEC2Resource):
|
||||
|
||||
# Flesh out data structures and associations
|
||||
for nic in nic_spec.values():
|
||||
use_eni = None
|
||||
security_group_ids = []
|
||||
|
||||
device_index = int(nic.get('DeviceIndex'))
|
||||
|
||||
nic_id = nic.get('NetworkInterfaceId', None)
|
||||
nic_id = nic.get('NetworkInterfaceId')
|
||||
if nic_id:
|
||||
# If existing NIC found, use it.
|
||||
use_nic = self.ec2_backend.get_network_interface(nic_id)
|
||||
@ -430,11 +427,11 @@ class Instance(BotoInstance, TaggedEC2Resource):
|
||||
|
||||
subnet = self.ec2_backend.get_subnet(nic['SubnetId'])
|
||||
|
||||
group_id = nic.get('SecurityGroupId',None)
|
||||
group_id = nic.get('SecurityGroupId')
|
||||
group_ids = [group_id] if group_id else []
|
||||
|
||||
use_nic = self.ec2_backend.create_network_interface(subnet,
|
||||
nic.get('PrivateIpAddress',None),
|
||||
nic.get('PrivateIpAddress'),
|
||||
device_index=device_index,
|
||||
public_ip_auto_assign=nic.get('AssociatePublicIpAddress', False),
|
||||
group_ids=group_ids)
|
||||
@ -712,7 +709,7 @@ class TagBackend(object):
|
||||
resource_id_filters = []
|
||||
resource_type_filters = []
|
||||
value_filters = []
|
||||
if not filters is None:
|
||||
if filters is not None:
|
||||
for tag_filter in filters:
|
||||
if tag_filter in self.VALID_TAG_FILTERS:
|
||||
if tag_filter == 'key':
|
||||
@ -1485,8 +1482,8 @@ class VPCPeeringConnection(TaggedEC2Resource):
|
||||
def create_from_cloudformation_json(cls, resource_name, cloudformation_json):
|
||||
properties = cloudformation_json['Properties']
|
||||
|
||||
vpc = get_vpc(properties['VpcId'])
|
||||
peer_vpc = get_vpc(properties['PeerVpcId'])
|
||||
vpc = ec2_backend.get_vpc(properties['VpcId'])
|
||||
peer_vpc = ec2_backend.get_vpc(properties['PeerVpcId'])
|
||||
|
||||
vpc_pcx = ec2_backend.create_vpc_peering_connection(vpc, peer_vpc)
|
||||
|
||||
@ -1743,7 +1740,7 @@ class RouteTableBackend(object):
|
||||
|
||||
# Association does not yet exist, so create it.
|
||||
route_table = self.get_route_table(route_table_id)
|
||||
subnet = self.get_subnet(subnet_id) # Validate subnet exists
|
||||
self.get_subnet(subnet_id) # Validate subnet exists
|
||||
association_id = random_subnet_association_id()
|
||||
route_table.associations[association_id] = subnet_id
|
||||
return association_id
|
||||
@ -2031,8 +2028,7 @@ class SpotRequestBackend(object):
|
||||
spot_request_id, price, image_id, type, valid_from, valid_until,
|
||||
launch_group, availability_zone_group, key_name, security_groups,
|
||||
user_data, instance_type, placement, kernel_id, ramdisk_id,
|
||||
monitoring_enabled, subnet_id
|
||||
)
|
||||
monitoring_enabled, subnet_id)
|
||||
self.spot_instance_requests[spot_request_id] = request
|
||||
requests.append(request)
|
||||
return requests
|
||||
|
Loading…
Reference in New Issue
Block a user