Using OS_TENANT_NAME in heat-keystone-setup-domain

Tenant name was not provided in Keystone client, so it was not
authenticated properly and raised Unauthorized exception.

Change-Id: I0b86ffa3eeff4a9631e36f56f4e111bb5eadf8b6
Closes-Bug: #1435415
This commit is contained in:
Michal Rostecki 2015-03-24 12:26:11 +00:00
parent b738ee677f
commit 501ae172d0
1 changed files with 21 additions and 18 deletions

View File

@ -23,9 +23,10 @@ from oslo_config import cfg
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
DEBUG = False DEBUG = False
USERNAME = os.environ.get('OS_USERNAME', None) USERNAME = os.environ.get('OS_USERNAME')
PASSWORD = os.environ.get('OS_PASSWORD', None) PASSWORD = os.environ.get('OS_PASSWORD')
AUTH_URL = os.environ.get('OS_AUTH_URL', '').replace('v2.0', 'v3') AUTH_URL = os.environ.get('OS_AUTH_URL', '').replace('v2.0', 'v3')
TENANT_NAME = os.environ.get('OS_TENANT_NAME')
opts = [ opts = [
cfg.StrOpt('stack-user-domain-name', cfg.StrOpt('stack-user-domain-name',
@ -79,23 +80,25 @@ def main():
level=log_lvl) level=log_lvl)
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING) logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
if insecure: client_kwargs = {
c = client.Client(debug=DEBUG, 'debug': DEBUG,
username=USERNAME, 'username': USERNAME,
password=PASSWORD, 'password': PASSWORD,
auth_url=AUTH_URL, 'auth_url': AUTH_URL,
endpoint=AUTH_URL, 'endpoint': AUTH_URL,
verify=False) 'tenant_name': TENANT_NAME
else: }
c = client.Client(debug=DEBUG,
username=USERNAME,
password=PASSWORD,
auth_url=AUTH_URL,
endpoint=AUTH_URL,
cacert=CACERT,
cert=CERT,
key=KEY)
if insecure:
client_kwargs['verify'] = False
else:
client_kwargs.update({
'cacert': CACERT,
'cert': CERT,
'key': KEY
})
c = client.Client(**client_kwargs)
c.authenticate() c.authenticate()
# Create the heat domain # Create the heat domain