From e505d194d346a8aa897f3e43473bf1492463f5dd Mon Sep 17 00:00:00 2001 From: Andrew Forrest Date: Wed, 27 Nov 2013 10:05:03 -0800 Subject: [PATCH] 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 --- inception/orchestrator.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inception/orchestrator.py b/inception/orchestrator.py index 9887cc0..bc1c95c 100644 --- a/inception/orchestrator.py +++ b/inception/orchestrator.py @@ -39,6 +39,7 @@ import functools import logging import os import Queue +import re import subprocess import time @@ -229,6 +230,12 @@ class Orchestrator(object): os.environ['OS_PASSWORD'], os.environ['OS_TENANT_NAME'], 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_ip = None self._gateway_name = None