Some EC2 fixes for alternative regions.
This commit is contained in:
parent
0cae959f05
commit
2d65b0a020
16 changed files with 153 additions and 154 deletions
|
|
@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
|||
from jinja2 import Template
|
||||
|
||||
from moto.core.responses import BaseResponse
|
||||
from moto.ec2.models import ec2_backend
|
||||
from moto.ec2.utils import route_table_ids_from_querystring, filters_from_querystring, optional_from_querystring
|
||||
|
||||
|
||||
|
|
@ -10,7 +9,7 @@ class RouteTables(BaseResponse):
|
|||
def associate_route_table(self):
|
||||
route_table_id = self.querystring.get('RouteTableId')[0]
|
||||
subnet_id = self.querystring.get('SubnetId')[0]
|
||||
association_id = ec2_backend.associate_route_table(route_table_id, subnet_id)
|
||||
association_id = self.ec2_backend.associate_route_table(route_table_id, subnet_id)
|
||||
template = Template(ASSOCIATE_ROUTE_TABLE_RESPONSE)
|
||||
return template.render(association_id=association_id)
|
||||
|
||||
|
|
@ -23,7 +22,7 @@ class RouteTables(BaseResponse):
|
|||
interface_id = optional_from_querystring('NetworkInterfaceId', self.querystring)
|
||||
pcx_id = optional_from_querystring('VpcPeeringConnectionId', self.querystring)
|
||||
|
||||
route = ec2_backend.create_route(route_table_id, destination_cidr_block,
|
||||
route = self.ec2_backend.create_route(route_table_id, destination_cidr_block,
|
||||
gateway_id=internet_gateway_id,
|
||||
instance_id=instance_id,
|
||||
interface_id=interface_id,
|
||||
|
|
@ -34,33 +33,33 @@ class RouteTables(BaseResponse):
|
|||
|
||||
def create_route_table(self):
|
||||
vpc_id = self.querystring.get('VpcId')[0]
|
||||
route_table = ec2_backend.create_route_table(vpc_id)
|
||||
route_table = self.ec2_backend.create_route_table(vpc_id)
|
||||
template = Template(CREATE_ROUTE_TABLE_RESPONSE)
|
||||
return template.render(route_table=route_table)
|
||||
|
||||
def delete_route(self):
|
||||
route_table_id = self.querystring.get('RouteTableId')[0]
|
||||
destination_cidr_block = self.querystring.get('DestinationCidrBlock')[0]
|
||||
ec2_backend.delete_route(route_table_id, destination_cidr_block)
|
||||
self.ec2_backend.delete_route(route_table_id, destination_cidr_block)
|
||||
template = Template(DELETE_ROUTE_RESPONSE)
|
||||
return template.render()
|
||||
|
||||
def delete_route_table(self):
|
||||
route_table_id = self.querystring.get('RouteTableId')[0]
|
||||
ec2_backend.delete_route_table(route_table_id)
|
||||
self.ec2_backend.delete_route_table(route_table_id)
|
||||
template = Template(DELETE_ROUTE_TABLE_RESPONSE)
|
||||
return template.render()
|
||||
|
||||
def describe_route_tables(self):
|
||||
route_table_ids = route_table_ids_from_querystring(self.querystring)
|
||||
filters = filters_from_querystring(self.querystring)
|
||||
route_tables = ec2_backend.get_all_route_tables(route_table_ids, filters)
|
||||
route_tables = self.ec2_backend.get_all_route_tables(route_table_ids, filters)
|
||||
template = Template(DESCRIBE_ROUTE_TABLES_RESPONSE)
|
||||
return template.render(route_tables=route_tables)
|
||||
|
||||
def disassociate_route_table(self):
|
||||
association_id = self.querystring.get('AssociationId')[0]
|
||||
ec2_backend.disassociate_route_table(association_id)
|
||||
self.ec2_backend.disassociate_route_table(association_id)
|
||||
template = Template(DISASSOCIATE_ROUTE_TABLE_RESPONSE)
|
||||
return template.render()
|
||||
|
||||
|
|
@ -73,7 +72,7 @@ class RouteTables(BaseResponse):
|
|||
interface_id = optional_from_querystring('NetworkInterfaceId', self.querystring)
|
||||
pcx_id = optional_from_querystring('VpcPeeringConnectionId', self.querystring)
|
||||
|
||||
route = ec2_backend.replace_route(route_table_id, destination_cidr_block,
|
||||
route = self.ec2_backend.replace_route(route_table_id, destination_cidr_block,
|
||||
gateway_id=internet_gateway_id,
|
||||
instance_id=instance_id,
|
||||
interface_id=interface_id,
|
||||
|
|
@ -85,7 +84,7 @@ class RouteTables(BaseResponse):
|
|||
def replace_route_table_association(self):
|
||||
route_table_id = self.querystring.get('RouteTableId')[0]
|
||||
association_id = self.querystring.get('AssociationId')[0]
|
||||
new_association_id = ec2_backend.replace_route_table_association(association_id, route_table_id)
|
||||
new_association_id = self.ec2_backend.replace_route_table_association(association_id, route_table_id)
|
||||
template = Template(REPLACE_ROUTE_TABLE_ASSOCIATION_RESPONSE)
|
||||
return template.render(association_id=new_association_id)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue