From 71cf291cf2d2140b1a993d9695d8d171e45c9a93 Mon Sep 17 00:00:00 2001 From: Vipin Balachandran Date: Fri, 15 Jul 2016 16:45:54 +0530 Subject: [PATCH] Remove generate_driver_list dependency on cur dir tools/generate_driver_list.py assumes that the current directory is the Cinder root directory. If the script is run from a different directory, it doesn't generate the driver info. This patch changes the current directory to the root directory before calling the utility functions to generate the driver list. Closes-bug: #1604269 Change-Id: I35829003868531ccd76ee26e83e0b51067984a6a --- tools/generate_driver_list.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tools/generate_driver_list.py b/tools/generate_driver_list.py index d7531b46f8a..61a5edd3e37 100755 --- a/tools/generate_driver_list.py +++ b/tools/generate_driver_list.py @@ -14,6 +14,8 @@ """Generate list of cinder drivers""" +import os + from cinder.interface import util @@ -39,18 +41,25 @@ def print_drivers(drivers, config_name): def main(): - print('VOLUME DRIVERS') - print('==============') - print_drivers(util.get_volume_drivers(), 'volume_driver') + tools_dir = os.path.dirname(os.path.abspath(__file__)) + cinder_root = os.path.dirname(tools_dir) + cur_dir = os.getcwd() + os.chdir(cinder_root) - print('BACKUP DRIVERS') - print('==============') - print_drivers(util.get_backup_drivers(), 'backup_driver') + try: + print('VOLUME DRIVERS') + print('==============') + print_drivers(util.get_volume_drivers(), 'volume_driver') - print('FC ZONE MANAGER DRIVERS') - print('=======================') - print_drivers(util.get_fczm_drivers(), 'zone_driver') + print('BACKUP DRIVERS') + print('==============') + print_drivers(util.get_backup_drivers(), 'backup_driver') + print('FC ZONE MANAGER DRIVERS') + print('=======================') + print_drivers(util.get_fczm_drivers(), 'zone_driver') + finally: + os.chdir(cur_dir) if __name__ == '__main__': main()