libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [1/3] libcloud git commit: added ability to use node or node_id as an argument to clean_failed_deployment
Date Fri, 15 Apr 2016 00:51:09 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk eaba89186 -> 97e9bcce6


added ability to use node or node_id as an argument to clean_failed_deployment


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

Branch: refs/heads/trunk
Commit: aa7208ab79721c2ce84d25047ce86cd2dde5f10a
Parents: da06e86
Author: Lawrence Lui <lawrence.lui@itaas.dimensiondata.com>
Authored: Thu Apr 14 10:17:56 2016 -0700
Committer: anthony-shaw <anthonyshaw@apache.org>
Committed: Fri Apr 15 10:50:40 2016 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py                    | 8 ++++++--
 ...8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml | 2 +-
 libcloud/test/compute/test_dimensiondata.py                  | 7 ++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/aa7208ab/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index d8ad735..1b54559 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -1831,10 +1831,14 @@ class DimensionDataNodeDriver(NodeDriver):
         Removes a node that has failed to deploy
 
         :param  node: The failed node to clean
-        :type   node: :class:`Node`
+        :type   node: :class:`Node` or ``str``
         """
+        if isinstance(node, str):
+            node_id = node
+        else:
+            node_id = node.id
         request_elm = ET.Element('cleanServer',
-                                 {'xmlns': TYPES_URN, 'id': node.id})
+                                 {'xmlns': TYPES_URN, 'id': node_id})
         body = self.connection.request_with_orgId_api_2(
             'server/cleanServer',
             method='POST',

http://git-wip-us.apache.org/repos/asf/libcloud/blob/aa7208ab/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml
b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml
index d289efd..011dfd4 100644
--- a/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml
+++ b/libcloud/test/compute/fixtures/dimensiondata/caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml
@@ -5,5 +5,5 @@ xmlns="urn:didata.com:api:cloud:types" requestId="au/2016-04-
 <operation>CLEAN_SERVER</operation>
 <responseCode>IN_PROGRESS</responseCode>
 <message>The request to clean a failed Server deployment for Server
-ee9dd854-f013-4006-89f9-d9f3f97dff57 has been accepted and is being processed.</message>
+e75ead52-692f-4314-8725-c8a4f4d13a87 has been accepted and is being processed.</message>
 </response>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/aa7208ab/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata.py b/libcloud/test/compute/test_dimensiondata.py
index ad01321..db6d994 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -186,12 +186,17 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
         self.assertEqual(images[0].extra['cpu'].cpu_count, 2)
         self.assertEqual(images[0].extra['OS_displayName'], 'REDHAT6/64')
 
-    def test_clean_failed_deployment_response(self):
+    def test_clean_failed_deployment_response_with_node(self):
         node = Node(id='11', name=None, state=None,
                     public_ips=None, private_ips=None, driver=self.driver)
         ret = self.driver.ex_clean_failed_deployment(node)
         self.assertTrue(ret is True)
 
+    def test_clean_failed_deployment_response_with_node_id(self):
+        node = 'e75ead52-692f-4314-8725-c8a4f4d13a87'
+        ret = self.driver.ex_clean_failed_deployment(node)
+        self.assertTrue(ret is True)
+
     def test_ex_list_customer_images(self):
         images = self.driver.ex_list_customer_images()
         self.assertEqual(len(images), 3)


Mime
View raw message