From 1a64ff8dda0e428670712550d8f6f33dc57b853e Mon Sep 17 00:00:00 2001 From: Joshua Kraitberg Date: Mon, 22 Aug 2022 09:29:23 -0400 Subject: [PATCH] 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 Change-Id: I8409ea6233b8eb94fc75158c5dba96c9a71872f9 --- .../storage_topology/exec/storage_topology.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/tools/storage-topology/storage-topology/storage_topology/exec/storage_topology.py b/tools/storage-topology/storage-topology/storage_topology/exec/storage_topology.py index 8c4aac4f2..4275b82ae 100644 --- a/tools/storage-topology/storage-topology/storage_topology/exec/storage_topology.py +++ b/tools/storage-topology/storage-topology/storage_topology/exec/storage_topology.py @@ -20,6 +20,8 @@ Tool to show a consolidated view of system physical disks and logical volume groups data. """ +from __future__ import absolute_import + import os import sys import argparse @@ -150,16 +152,9 @@ def get_system_creds(): for line in proc.stdout: key, _, value = line.partition("=") - if key == 'OS_USERNAME': - d['os_username'] = value.strip() - elif key == 'OS_PASSWORD': - 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() + # Scrape env credentials using shared prefix + if key.startswith('OS_'): + d[key.lower()] = value.strip() proc.communicate() return d @@ -421,9 +416,9 @@ def main(): raise exc.CommandError("You must provide a password via " "env[OS_PASSWORD]") - if not cgts_client_creds['os_tenant_name']: - raise exc.CommandError("You must provide a tenant_id via " - "env[OS_TENANT_NAME]") + if not cgts_client_creds['os_project_name']: + raise exc.CommandError("You must provide a project_id via " + "env[OS_PROJECT_NAME]") if not cgts_client_creds['os_auth_url']: raise exc.CommandError("You must provide a auth url via "