Modify ex_delete_subnet method to take a EC2NetworkSubnet instance instead.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4abc2194
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4abc2194
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4abc2194

Branch: refs/heads/trunk
Commit: 4abc21946cfd42f8b6f773caa8d847edd17f88ae
Parents: ee69f99
Author: Tomaz Muraus <[email protected]>
Authored: Thu Dec 26 14:16:05 2013 +0100
Committer: Tomaz Muraus <[email protected]>
Committed: Thu Dec 26 14:16:05 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py   | 8 ++++----
 libcloud/test/compute/test_ec2.py | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4abc2194/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 61d6f4b..a13201e 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -1693,16 +1693,16 @@ class BaseEC2NodeDriver(NodeDriver):
 
         return subnet
 
-    def ex_delete_subnet(self, subnet_id):
+    def ex_delete_subnet(self, subnet):
         """
         Deletes a VPC subnet.
 
-        :param      subnet_id: The ID of the subnet
-        :type       subnet_id: ``str``
+        :param      subnet: The subnet to delete
+        :type       subnet: :class:`.EC2NetworkSubnet`
 
         :rtype:     ``bool``
         """
-        params = {'Action': 'DeleteSubnet', 'SubnetId': subnet_id}
+        params = {'Action': 'DeleteSubnet', 'SubnetId': subnet.id}
 
         result = self.connection.request(self.path, params=params).object
         element = findtext(element=result,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4abc2194/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py 
b/libcloud/test/compute/test_ec2.py
index 3283d55..239b9ef 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -835,7 +835,8 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
         self.assertEqual('vpc-532135d1', subnet.extra['vpc_id'])
 
     def test_ex_delete_subnet(self):
-        resp = self.driver.ex_delete_subnet('subnet-ce0e7ce6')
+        subnet = self.driver.ex_list_subnets()[0]
+        resp = self.driver.ex_delete_subnet(subnet=subnet)
         self.assertTrue(resp)
 
 

Reply via email to