Merge lp://staging/~franciscosouza/txaws/txaws-secgroupid into lp://staging/txaws

Proposed by Francisco Souza
Status: Needs review
Proposed branch: lp://staging/~franciscosouza/txaws/txaws-secgroupid
Merge into: lp://staging/txaws
Diff against target: 279 lines (+104/-14)
5 files modified
txaws/ec2/client.py (+20/-6)
txaws/ec2/model.py (+2/-1)
txaws/ec2/tests/test_client.py (+71/-3)
txaws/ec2/tests/test_model.py (+6/-4)
txaws/testing/payload.py (+5/-0)
To merge this branch: bzr merge lp://staging/~franciscosouza/txaws/txaws-secgroupid
Reviewer Review Type Date Requested Status
txAWS Committers Pending
Review via email: mp+133542@code.staging.launchpad.net

Description of the change

ec2: recognize ID on security groups

When using VPC, security groups are identified by ID, not name.

https://codereview.appspot.com/6822097/

To post a comment you must log in.
Revision history for this message
Chico (franciscossouza) wrote :
Download full text (9.5 KiB)

Reviewers: mp+133542_code.launchpad.net,

Message:
Please take a look.

Description:
ec2: recognize ID on security groups

When using VPC, security groups are identified by ID, not name.

https://code.launchpad.net/~franciscosouza/txaws/txaws-secgroupid/+merge/133542

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/6822097/

Affected files:
   A [revision details]
   M txaws/ec2/client.py
   M txaws/ec2/model.py
   M txaws/ec2/tests/test_client.py
   M txaws/ec2/tests/test_model.py
   M txaws/testing/payload.py

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: txaws/ec2/client.py
=== modified file 'txaws/ec2/client.py'
--- txaws/ec2/client.py 2012-05-05 00:17:02 +0000
+++ txaws/ec2/client.py 2012-11-08 18:46:21 +0000
@@ -125,13 +125,18 @@
          d = query.submit()
          return d.addCallback(self.parser.truth_return)

- def delete_security_group(self, name):
+ def delete_security_group(self, name=None, id=None):
          """
          @param name: Name of the new security group.
          @return: A C{Deferred} that will fire with a truth value for the
              success of the operation.
          """
- parameter = {"GroupName": name}
+ if name:
+ parameter = {"GroupName": name}
+ elif id:
+ parameter = {"GroupId": id}
+ else:
+ raise ValueError("You must provide either the security group
name or id")
          query = self.query_factory(
              action="DeleteSecurityGroup", creds=self.creds,
              endpoint=self.endpoint, other_params=parameter)
@@ -670,6 +675,7 @@
          root = XML(xml_bytes)
          result = []
          for group_info in root.findall("securityGroupInfo/item"):
+ id = group_info.findtext("groupId")
              name = group_info.findtext("groupName")
              description = group_info.findtext("groupDescription")
              owner_id = group_info.findtext("ownerId")
@@ -709,7 +715,7 @@
                                for user_id, group_name in allowed_groups]

              security_group = model.SecurityGroup(
- name, description, owner_id=owner_id,
+ id, name, description, owner_id=owner_id,
                  groups=allowed_groups, ips=allowed_ips)
              result.append(security_group)
          return result

Index: txaws/ec2/model.py
=== modified file 'txaws/ec2/model.py'
--- txaws/ec2/model.py 2012-03-02 22:00:10 +0000
+++ txaws/ec2/model.py 2012-11-08 18:37:45 +0000
@@ -80,7 +80,8 @@
      @ivar allowed_ips: The sequence of L{IPPermission} instances for this
          security group.
      """
- def __init__(self, name, description, owner_id="", groups=None,
ips=None):
+ def __init__(self, id, name, description, owner_id="", groups=None,
ips=None):
+ self.id = id
          self.name = name
          self.description = description
     ...

Read more...

Revision history for this message
Chico (franciscossouza) wrote :

On 2012/11/08 18:50:48, fss wrote:
> Please take a look.

Please hold on, I forgot to include create_security_group change.

https://codereview.appspot.com/6822097/

154. By Francisco Souza

ec2: return the id of the group on create_security_group

Revision history for this message
Chico (franciscossouza) wrote :
155. By Francisco Souza

ec2: support vpc_id on create_security_group

Revision history for this message
Chico (franciscossouza) wrote :
156. By Francisco Souza

ec2: added docs for new parameters

Revision history for this message
Chico (franciscossouza) wrote :

Unmerged revisions

156. By Francisco Souza

ec2: added docs for new parameters

155. By Francisco Souza

ec2: support vpc_id on create_security_group

154. By Francisco Souza

ec2: return the id of the group on create_security_group

153. By Francisco Souza

ec2: make delete_security_group support deletion by ID

VPC uses ID for identifying groups, always.

152. By Francisco Souza

ec2: add support for ID in describe_security_groups

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches