Add behavior to enable ironic noauth mode

Added behavior to enable users to utilize the ironic functionality with noauth
mode set on the server side.  This logic is utilized if the auth_plugin is
defined as: None or "None" or ''. Bumped os-client-config requirement
because this working requires the pass-through support that got added
there in 0.5.0.

Change-Id: I3f8a9e0a9952be2d24c6cb655dfed9519134102e
This commit is contained in:
Julia Kreger 2015-02-26 16:01:50 -05:00 committed by Monty Taylor
parent 61763992c9
commit 62616f3eaa
2 changed files with 20 additions and 2 deletions

View File

@ -1,6 +1,6 @@
pbr>=0.5.21,<1.0
os-client-config>=0.4.0
os-client-config>=0.5.0
six
python-novaclient>=2.21.0

View File

@ -1235,13 +1235,31 @@ class OpenStackCloud(object):
class OperatorCloud(OpenStackCloud):
@property
def auth_token(self):
if self.auth_plugin in (None, "None", ''):
return self._auth_token
if not self._auth_token:
self._auth_token = self.keystone_session.get_token()
return self._auth_token
@property
def ironic_client(self):
if self._ironic_client is None:
ironic_logging = logging.getLogger('ironicclient')
ironic_logging.addHandler(logging.NullHandler())
token = self.auth_token
endpoint = self.get_endpoint(service_type='baremetal')
if self.auth_plugin in (None, "None", ''):
# TODO: This needs to be improved logic wise, perhaps a list,
# or enhancement of the data stuctures with-in the library
# to allow for things aside password authentication, or no
# authentication if so desired by the user.
#
# Attempt to utilize a pre-stored endpoint in the auth
# dict as the endpoint.
endpoint = self.auth['endpoint']
else:
endpoint = self.get_endpoint(service_type='baremetal')
try:
self._ironic_client = ironic_client.Client(
'1', endpoint, token=token)