Lazy load oauthlib for plugin loading

If oauthlib is not available the oauth plugins should not be marked as
available when iterating plugins.

Change-Id: Idabb7adf61dc5ca36fc1524af47e346f8f296245
This commit is contained in:
Jamie Lennox 2016-07-22 04:16:04 +10:00
parent 88d4fdb14a
commit 6306504c58
2 changed files with 8 additions and 1 deletions

View File

@ -22,6 +22,10 @@ class V3OAuth1(loading.BaseIdentityLoader):
def plugin_class(self):
return v3.OAuth1
@property
def available(self):
return v3.oauth1 is not None
def get_options(self):
options = super(V3OAuth1, self).get_options()

View File

@ -23,7 +23,10 @@
import logging
from oauthlib import oauth1
try:
from oauthlib import oauth1
except ImportError:
oauth1 = None
from keystoneauth1.identity import v3