Allow for compatable auths between new and old CLI

The new CLI allows for Rax auth, but alas it does not work the same way
as the old CLI did. This means that any scripts using both have to have
their auth URLs switched.

The fix for this is to include a new auth type for the old CLI tool
that adds "/tokens" to the auth URL the way the new CLI does.

Fixes bug 1253746

Change-Id: I5705d87033cc42b9dfa136ca13e4e5ab83bd666d
This commit is contained in:
Tim Simpson
2013-11-21 12:44:08 -06:00
parent 0a174425e3
commit 1e38ffc7ae

View File

@@ -26,6 +26,8 @@ def get_authenticator_cls(cls_or_name):
return KeyStoneV2Authenticator
elif cls_or_name == "rax":
return RaxAuthenticator
elif cls_or_name == "rax2":
return RaxAuthenticator2
elif cls_or_name == "auth1.1":
return Auth1_1
elif cls_or_name == "fake":
@@ -151,6 +153,17 @@ class RaxAuthenticator(Authenticator):
return self._authenticate(self.url, body)
class RaxAuthenticator2(RaxAuthenticator):
"""
Necessary to be able to call using the same auth url as the new client
uses for Rax auth.
"""
def __init__(self, *args, **kwargs):
super(RaxAuthenticator2, self).__init__(*args, **kwargs)
self.url = "%s/tokens" % self.url
class FakeAuth(Authenticator):
"""Useful for faking auth."""