Backward compatibility with 2.3

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

Branch: refs/heads/trunk
Commit: 9cb7785e1707b7c688820a7a7a6a8a1df9c19597
Parents: 1c2f34a
Author: Samuel Chong <samuelcho...@gmail.com>
Authored: Wed Nov 9 10:26:23 2016 +1100
Committer: Samuel Chong <samuelcho...@gmail.com>
Committed: Wed Nov 9 10:26:23 2016 +1100

----------------------------------------------------------------------
 libcloud/common/dimensiondata.py          |  2 +-
 libcloud/compute/drivers/dimensiondata.py | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9cb7785e/libcloud/common/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py
index ac42871..bf2631e 100644
--- a/libcloud/common/dimensiondata.py
+++ b/libcloud/common/dimensiondata.py
@@ -383,7 +383,7 @@ class DimensionDataConnection(ConnectionUserAndKey):
     oldest_api_version = 2.2
 
     # Latest version supported
-    latest_api_version = 2.3
+    latest_api_version = 2.4
 
     # Default api version
     active_api_version = 2.3

http://git-wip-us.apache.org/repos/asf/libcloud/blob/9cb7785e/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py 
b/libcloud/compute/drivers/dimensiondata.py
index c574d09..b0a5959 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -787,7 +787,7 @@ class DimensionDataNodeDriver(NodeDriver):
 
         Note:  Currently only returns the default 'base OS images'
                provided by DimensionData. Customer images (snapshots)
-               are not yet supported.
+               use ex_list_customer_images
 
         :keyword ex_location: Filters the node list to nodes that are
                               located in this location
@@ -800,12 +800,20 @@ class DimensionDataNodeDriver(NodeDriver):
         if location is not None:
             params['datacenterId'] = self._location_to_location_id(location)
 
-        return self._to_images(
+        # return self._to_images(
+        #     self.connection.request_with_orgId_api_2(
+        #         'image/osImage',
+        #         params=params)
+        #     .object)
+
+        images = self._to_images(
             self.connection.request_with_orgId_api_2(
                 'image/osImage',
                 params=params)
             .object)
 
+        return images
+
     def list_sizes(self, location=None):
         """
         return a list of available sizes
@@ -3653,7 +3661,11 @@ class DimensionDataNodeDriver(NodeDriver):
                                locations))[0]
 
         cpu_spec = self._to_cpu_spec(element.find(fixxpath('cpu', TYPES_URN)))
-        os_el = element.find(fixxpath('guest/operatingSystem', TYPES_URN))
+
+        if float(self.connection.active_api_version) > 2.3:
+            os_el = element.find(fixxpath('guest/operatingSystem', TYPES_URN))
+        else:
+            os_el = element.find(fixxpath('operatingSystem', TYPES_URN))
 
         if element.tag.endswith('customerImage'):
             is_customer_image = True

Reply via email to