Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. def fix_auth_url_version(auth_url):
  2. """Fix up the auth url if an invalid version prefix was given.
  3.  
  4. People still give a v2 auth_url even when they specify that they want v3
  5. authentication. Fix the URL to say v3. This should be smarter and take the
  6. base, unversioned URL and discovery.
  7. """
  8. if get_keystone_version() >= 3:
  9. if has_in_url_path(auth_url, "/v2.0"):
  10. LOG.warning("The settings.py file points to a v2.0 keystone "
  11. "endpoint, but v3 is specified as the API version "
  12. "to use. Using v3 endpoint for authentication.")
  13. auth_url = url_path_replace(auth_url, "/v2.0", "/v3", 1)
  14. elif urlparse.urlsplit(auth_url).path.strip('/') == '':
  15. auth_url = urlparse.urljoin(auth_url, "/v3")
  16.  
  17. return auth_url
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement