Support use of token value in place of password.

blueprint horizon-webui

(Auto-linking to blueprint either doesn't work for this project
or requires additional info not prescribed. Here is full link:
https://blueprints.launchpad.net/inception/+spec/horizon-webui

While python-novaclient will re-authenticate using an internally
saved copy of an authorization token, this capability is not
exposed to its API user requiring the use of a password whenever
creating a Client object.  In order to authenticate requests made
on behalf of a web (horizon) user this capability needs to be
utilized as the horizon web app has only a token once the user
logs in.  This change depends on the structure of the client
and is the first place to look for problems once the underlying
API software is revised.

Partially implements: blueprint horizon-webui

Change-Id: Ifa9cb7877eabff1514cb2272407d6daf08beef7f
This commit is contained in:
Andrew Forrest 2013-11-27 10:05:03 -08:00
parent 9346b6af1d
commit e505d194d3
1 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,7 @@ import functools
import logging import logging
import os import os
import Queue import Queue
import re
import subprocess import subprocess
import time import time
@ -229,6 +230,12 @@ class Orchestrator(object):
os.environ['OS_PASSWORD'], os.environ['OS_PASSWORD'],
os.environ['OS_TENANT_NAME'], os.environ['OS_TENANT_NAME'],
os.environ['OS_AUTH_URL']) os.environ['OS_AUTH_URL'])
# If the password offered is actually a 32 byte hex digit string
# then it's probably a token
if re.match('\A[\da-fA-F]{32}\Z', os.environ['OS_PASSWORD']):
self.client.client.auth_token = os.environ['OS_PASSWORD']
self._gateway_id = None self._gateway_id = None
self._gateway_ip = None self._gateway_ip = None
self._gateway_name = None self._gateway_name = None