Skip to content

Commit

Permalink
Moving backend/ec2 to boto3
Browse files Browse the repository at this point in the history
  • Loading branch information
aske committed Oct 30, 2017
1 parent 79506da commit 92e0fac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nixops/backends/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,9 @@ def _assign_elastic_ip(self, elastic_ipv4, check):
def security_groups_to_ids(self, subnetId, groups):
sg_names = filter(lambda g: not g.startswith('sg-'), groups)
if sg_names != [ ] and subnetId != "":
self.connect_vpc()
vpc_id = self._conn_vpc.get_all_subnets([subnetId])[0].vpc_id
self.connect()
subnet_id_filter = {'Name': 'subnet-id', 'Values': [vpc_id]}
vpc_id = [vpc.vpc_id for vpc in self._conn.subnets.filter(Filters=[subnet_id_filter]).limit(1)][0]
groups = map(lambda g: nixops.ec2_utils.name_to_security_group(self._conn, g, vpc_id), groups)

return groups
Expand Down

0 comments on commit 92e0fac

Please sign in to comment.