Update legacy keystone credential tenant to project

Keystone has standardized the term "project" as the
entity that owns resources, replacing the previous
term "tenant".  Without this change this tool will
not work due to authentication issues.

Test Plan:
Install tools/storage-topology and run it on controller

Closes-Bug: 1987297

Signed-off-by: Joshua Kraitberg <joshua.kraitberg@windriver.com>
Change-Id: I8409ea6233b8eb94fc75158c5dba96c9a71872f9
This commit is contained in:
Joshua Kraitberg 2022-08-22 09:29:23 -04:00
parent 8749bc9656
commit 1a64ff8dda

View File

@ -20,6 +20,8 @@ Tool to show a consolidated view of system physical disks and logical volume
groups data. groups data.
""" """
from __future__ import absolute_import
import os import os
import sys import sys
import argparse import argparse
@ -150,16 +152,9 @@ def get_system_creds():
for line in proc.stdout: for line in proc.stdout:
key, _, value = line.partition("=") key, _, value = line.partition("=")
if key == 'OS_USERNAME': # Scrape env credentials using shared prefix
d['os_username'] = value.strip() if key.startswith('OS_'):
elif key == 'OS_PASSWORD': d[key.lower()] = value.strip()
d['os_password'] = value.strip()
elif key == 'OS_TENANT_NAME':
d['os_tenant_name'] = value.strip()
elif key == 'OS_AUTH_URL':
d['os_auth_url'] = value.strip()
elif key == 'OS_REGION_NAME':
d['os_region_name'] = value.strip()
proc.communicate() proc.communicate()
return d return d
@ -421,9 +416,9 @@ def main():
raise exc.CommandError("You must provide a password via " raise exc.CommandError("You must provide a password via "
"env[OS_PASSWORD]") "env[OS_PASSWORD]")
if not cgts_client_creds['os_tenant_name']: if not cgts_client_creds['os_project_name']:
raise exc.CommandError("You must provide a tenant_id via " raise exc.CommandError("You must provide a project_id via "
"env[OS_TENANT_NAME]") "env[OS_PROJECT_NAME]")
if not cgts_client_creds['os_auth_url']: if not cgts_client_creds['os_auth_url']:
raise exc.CommandError("You must provide a auth url via " raise exc.CommandError("You must provide a auth url via "