Просмотр исходного кода

On AWS, search for security groups via filters vs. method parameter.

Earlier used method parameter is restricted to EC2-Classic and default VPC only:
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html
Enis Afgan 10 лет назад
Родитель
Сommit
27f117da55
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      cloudbridge/cloud/providers/aws/services.py

+ 2 - 1
cloudbridge/cloud/providers/aws/services.py

@@ -193,8 +193,9 @@ class AWSSecurityGroupService(BaseSecurityGroupService):
         Get all security groups associated with your account.
         Get all security groups associated with your account.
         """
         """
         try:
         try:
+            flters = {'group-name': name}
             security_groups = self.provider.ec2_conn.get_all_security_groups(
             security_groups = self.provider.ec2_conn.get_all_security_groups(
-                groupnames=[name])
+                filters=flters)
         except EC2ResponseError:
         except EC2ResponseError:
             security_groups = []
             security_groups = []
         return [AWSSecurityGroup(self.provider, sg) for sg in security_groups]
         return [AWSSecurityGroup(self.provider, sg) for sg in security_groups]