You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/11/04 23:46:55 UTC
[2/5] git commit: Use ==, use single quotes, remove long comment,
this will be moved into documentation.
Use ==, use single quotes, remove long comment, this will be moved into
documentation.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cc4bb9b3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cc4bb9b3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cc4bb9b3
Branch: refs/heads/trunk
Commit: cc4bb9b39d6aedfaa5af68d69276d56d17564bc2
Parents: 7afee03
Author: Tomaz Muraus <to...@apache.org>
Authored: Mon Nov 4 21:20:20 2013 +0000
Committer: Tomaz Muraus <to...@apache.org>
Committed: Mon Nov 4 21:21:37 2013 +0000
----------------------------------------------------------------------
libcloud/common/openstack.py | 33 +++++-----------------------
libcloud/test/compute/test_openstack.py | 18 +++++++--------
2 files changed, 14 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/cc4bb9b3/libcloud/common/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index 085b364..f75ac94 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -120,34 +120,11 @@ class OpenStackAuthConnection(ConnectionUserAndKey):
self.auth_user_info = None
def morph_action_hook(self, action):
- (host, port, secure, request_path) = \
- self._tuple_from_url(self.auth_url)
-
- # for example auth_url is
- #
- # http://192.168.0.100 - assume path is not provided,
- # depending on the auth_version,
- # correct path should be appended
- # to the final url
- # if auth_version is 1.0
- # final is http://192.168.0.100/v1.0
- # if auth_version is 1.1
- # final is http://192.168.0.100/v1.1/auth
- # if auth_version is 2.0
- # final is http://192.168.0.100/v2.0/tokens
- #
- # http://192.168.0.100/ - assume path(foo/bar) is already
- # provided, nothing should be
- # apppended to the final url
- #
- # http://192.168.0.100/foo/bar - assume path(foo/bar) is already
- # provided, nothing should be
- # apppended to the final url
- #
- # http://192.168.0.100/foo/bar/ - assume path(foo/bar) is already
- # provided, nothing should be
- # appended to the final url
- if request_path is "":
+ (_, _, _, request_path) = self._tuple_from_url(self.auth_url)
+
+ if request_path == '':
+ # No path is provided in the auth_url, use action passed to this
+ # method.
return action
return request_path
http://git-wip-us.apache.org/repos/asf/libcloud/blob/cc4bb9b3/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index 16ffeeb..1c6f66b 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -133,18 +133,18 @@ class OpenStackAuthConnectionTests(unittest.TestCase):
NOTAPPEND = 1
auth_urls = [
- ("https://auth.api.example.com", APPEND, ''),
- ("https://auth.api.example.com/", NOTAPPEND, '/'),
- ("https://auth.api.example.com/foo/bar", NOTAPPEND, '/foo/bar'),
- ("https://auth.api.example.com/foo/bar/", NOTAPPEND, '/foo/bar/')
+ ('https://auth.api.example.com', APPEND, ''),
+ ('https://auth.api.example.com/', NOTAPPEND, '/'),
+ ('https://auth.api.example.com/foo/bar', NOTAPPEND, '/foo/bar'),
+ ('https://auth.api.example.com/foo/bar/', NOTAPPEND, '/foo/bar/')
]
actions = {
- "1.0": "/v1.0",
- "1.1": "/v1.1/auth",
- "2.0": "/v2.0/tokens",
- "2.0_apikey": "/v2.0/tokens",
- "2.0_password": "/v2.0/tokens"
+ '1.0': '/v1.0',
+ '1.1': '/v1.1/auth',
+ '2.0': '/v2.0/tokens',
+ '2.0_apikey': '/v2.0/tokens',
+ '2.0_password': '/v2.0/tokens'
}
user_id = OPENSTACK_PARAMS[0]