From b9de66d39e42d7fb1fd4ce244eaadb3ef7539fea Mon Sep 17 00:00:00 2001 From: Olivier Bourdon Date: Mon, 12 Feb 2018 13:25:24 +0100 Subject: [PATCH] Fix for proper usage when keystone enabled Using export BIFROST_INVENTORY_SOURCE=ironic one can now use the dynamic inventory when keystone is enabled Change-Id: I7a89169d421b83c76c67b748473751b7ba0ed1ad Depends-On: Ie73781d5e284908468a0f9ccff544f4c9c845fdd Depends-On: I250b202c4a319604bcd910e49c1d55bcad9e38e3 --- bifrost/inventory.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bifrost/inventory.py b/bifrost/inventory.py index 6b737d03f..04a56c4b0 100755 --- a/bifrost/inventory.py +++ b/bifrost/inventory.py @@ -310,16 +310,19 @@ def _process_baremetal_csv(data_source, groups, hostvars): def _identify_shade_auth(): """Return shade credentials""" - # Note(TheJulia): A logical progression is to support a user defining - # an environment variable that triggers use of os-client-config to allow - # environment variables or clouds.yaml auth configuration. This could - # potentially be passed in as variables which could then be passed - # to modules for authentication allowing the basic tooling to be - # utilized in the context of a larger cloud supporting ironic. options = dict( auth_type="None", auth=dict(endpoint="http://localhost:6385/",) ) + if os.environ.get('OS_AUTH_URL'): + options['auth_type'] = "password" + options['auth'] = dict( + username=os.getenv('OS_USERNAME', ""), + password=os.getenv('OS_PASSWORD', ""), + auth_url=os.getenv('OS_AUTH_URL', ""), + project_name=os.getenv('OS_PROJECT_NAME', ""), + domain_id=os.getenv('OS_USER_DOMAIN_NAME', ""), + ) return options