diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-10-22 15:11:52 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-10-22 15:11:52 +0000 |
commit | ce6dac20fe3d287b2b64cf18cef6ffeb8acc17ff (patch) | |
tree | aacad6b8f5720a65f5dcca3ed8bbf4bd7c75a5de /contrib | |
parent | 065de8289c93bf8fbffdee4a6092f8c1c5cb6741 (diff) | |
parent | 4e174fc6ac8d06a768fc5ce713ab510bd909defd (diff) | |
download | heat-ce6dac20fe3d287b2b64cf18cef6ffeb8acc17ff.tar.gz |
Merge "Validate tenant_id part of TempURL in clients"
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/rackspace/rackspace/clients.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/rackspace/rackspace/clients.py b/contrib/rackspace/rackspace/clients.py index 347148921..6c93cc049 100644 --- a/contrib/rackspace/rackspace/clients.py +++ b/contrib/rackspace/rackspace/clients.py @@ -178,6 +178,26 @@ class RackspaceCinderClient(cinder.CinderClientPlugin): class RackspaceSwiftClient(swift.SwiftClientPlugin): + def is_valid_temp_url_path(self, path): + '''Return True if path is a valid Swift TempURL path, False otherwise. + + A Swift TempURL path must: + - Be five parts, ['', 'v1', 'account', 'container', 'object'] + - Be a v1 request + - Have account, container, and object values + - Have an object value with more than just '/'s + + :param path: The TempURL path + :type path: string + ''' + parts = path.split('/', 4) + return bool(len(parts) == 5 and + not parts[0] and + parts[1] == 'v1' and + parts[2] and + parts[3] and + parts[4].strip('/')) + def get_temp_url(self, container_name, obj_name, timeout=None): ''' Return a Swift TempURL. |