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
This commit is contained in:
Olivier Bourdon 2018-02-12 13:25:24 +01:00
parent 78717f7ea4
commit b9de66d39e

View File

@ -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