Преглед изворни кода

Add a route so that subnet traffic can be routed to the gateway

Nuwan Goonasekera пре 8 година
родитељ
комит
5035dfd550
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      cloudbridge/cloud/providers/aws/resources.py

+ 4 - 1
cloudbridge/cloud/providers/aws/resources.py

@@ -1083,8 +1083,11 @@ class AWSRouter(BaseRouter):
     def attach_gateway(self, gateway):
         gw_id = (gateway.id if isinstance(gateway, AWSInternetGateway)
                  else gateway)
-        return self._provider.ec2_conn.meta.client.attach_internet_gateway(
+        result = self._provider.ec2_conn.meta.client.attach_internet_gateway(
             InternetGatewayId=gw_id, VpcId=self._route_table.vpc_id)
+        self._route_table.create_route(
+            DestinationCidrBlock='0.0.0.0/0', GatewayId=gw_id)
+        return result
 
     def detach_gateway(self, gateway):
         gw_id = (gateway.id if isinstance(gateway, AWSInternetGateway)