Repository: libcloud Updated Branches: refs/heads/trunk 216a24fbe -> 75b129e8b
Enable specifying api version Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f4caab37 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f4caab37 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f4caab37 Branch: refs/heads/trunk Commit: f4caab373b18e3c02cdfe3e4580cb03efb7a9199 Parents: 9e5976c Author: Samuel Chong <[email protected]> Authored: Thu Nov 3 11:10:07 2016 +1100 Committer: Samuel Chong <[email protected]> Committed: Thu Nov 3 11:10:07 2016 +1100 ---------------------------------------------------------------------- libcloud/common/dimensiondata.py | 7 ++++++- libcloud/compute/drivers/dimensiondata.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f4caab37/libcloud/common/dimensiondata.py ---------------------------------------------------------------------- diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py index bdcde5a..0a868b8 100644 --- a/libcloud/common/dimensiondata.py +++ b/libcloud/common/dimensiondata.py @@ -382,7 +382,8 @@ class DimensionDataConnection(ConnectionUserAndKey): allow_insecure = False def __init__(self, user_id, key, secure=True, host=None, port=None, - url=None, timeout=None, proxy_url=None, **conn_kwargs): + url=None, timeout=None, proxy_url=None, + api_version=None, **conn_kwargs): super(DimensionDataConnection, self).__init__( user_id=user_id, key=key, @@ -394,6 +395,10 @@ class DimensionDataConnection(ConnectionUserAndKey): if conn_kwargs['region']: self.host = conn_kwargs['region']['host'] + if api_version: + if api_version.startswith('2'): + self.api_version_2 = api_version + def add_default_headers(self, headers): headers['Authorization'] = \ ('Basic %s' % b64encode(b('%s:%s' % (self.user_id, http://git-wip-us.apache.org/repos/asf/libcloud/blob/f4caab37/libcloud/compute/drivers/dimensiondata.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py index 76dfb55..9e477b6 100644 --- a/libcloud/compute/drivers/dimensiondata.py +++ b/libcloud/compute/drivers/dimensiondata.py @@ -114,6 +114,9 @@ class DimensionDataNodeDriver(NodeDriver): if region is not None: self.selected_region = API_ENDPOINTS[region] + if api_version is not None: + self.api_version = api_version + super(DimensionDataNodeDriver, self).__init__(key=key, secret=secret, secure=secure, host=host, port=port, @@ -129,6 +132,7 @@ class DimensionDataNodeDriver(NodeDriver): kwargs = super(DimensionDataNodeDriver, self)._ex_connection_class_kwargs() kwargs['region'] = self.selected_region + kwargs['api_version'] = self.api_version return kwargs def _create_node_mcp1(self, name, image, auth, ex_description,
