Fixing find_config_file after packaging changes

Change-Id: I687793b0f8f7284019e05c044e53d91e0f3f09c2
This commit is contained in:
Tyler Smith 2011-03-29 23:15:10 -04:00
parent a9a39684d7
commit 8943ee9e59
7 changed files with 19 additions and 11 deletions

View File

@ -207,13 +207,12 @@ def find_config_file(options, args, config_file='quantum.conf'):
dir_to_common = os.path.dirname(os.path.abspath(__file__))
root = os.path.join(dir_to_common, '..', '..', '..', '..')
# Handle standard directory search for the config file
config_file_dirs = [fix_path(os.path.join(os.getcwd(), 'server', 'etc')),
config_file_dirs = [fix_path(os.path.join(os.getcwd(), 'etc')),
fix_path(os.path.join('~', '.quantum-venv', 'etc',
'quantum')),
fix_path('~'),
os.path.join(FLAGS.state_path, 'etc'),
os.path.join(FLAGS.state_path, 'etc', 'quantum'),
os.path.join(root, 'server', 'etc'),
fix_path(os.path.join('~', '.local',
'etc', 'quantum')),
'/usr/etc/quantum',
@ -221,6 +220,11 @@ def find_config_file(options, args, config_file='quantum.conf'):
'/etc/quantum/',
'/etc']
if 'plugin' in options:
config_file_dirs = [os.path.join(x, 'quantum', 'plugins',
options['plugin'])
for x in config_file_dirs]
if os.path.exists(os.path.join(root, 'plugins')):
plugins = [fix_path(os.path.join(root, 'plugins', p, 'etc'))
for p in os.listdir(os.path.join(root, 'plugins'))]

View File

@ -31,7 +31,8 @@ from quantum.plugins.cisco.db import l2network_db as cdb
LOG.basicConfig(level=LOG.WARN)
LOG.getLogger(const.LOGGER_COMPONENT_NAME)
CREDENTIALS_FILE = find_config_file({}, None, "credentials.ini")
CREDENTIALS_FILE = find_config_file({'plugin': 'cisco'}, None,
"credentials.ini")
TENANT = const.NETWORK_ADMIN
cp = confp.CiscoConfigParser(CREDENTIALS_FILE)

View File

@ -23,7 +23,7 @@ import os
from quantum.common.config import find_config_file
from quantum.plugins.cisco.common import cisco_configparser as confp
CONF_FILE = find_config_file({}, None, "l2network_plugin.ini")
CONF_FILE = find_config_file({'plugin': 'cisco'}, None, "l2network_plugin.ini")
CONF_PARSER_OBJ = confp.CiscoConfigParser(CONF_FILE)
"""
@ -46,7 +46,7 @@ MAX_NETWORKS = SECTION_CONF['max_networks']
SECTION_CONF = CONF_PARSER_OBJ['MODEL']
MODEL_CLASS = SECTION_CONF['model_class']
CONF_FILE = find_config_file({}, None, "cisco_plugins.ini")
CONF_FILE = find_config_file({'plugin': 'cisco'}, None, "cisco_plugins.ini")
SECTION_CONF = CONF_PARSER_OBJ['SEGMENTATION']
MANAGER_CLASS = SECTION_CONF['manager_class']
@ -59,7 +59,7 @@ Reading the config for the device plugins
"""
PLUGINS = CONF_PARSER_OBJ.walk(CONF_PARSER_OBJ.dummy)
CONF_FILE = find_config_file({}, None, "db_conn.ini")
CONF_FILE = find_config_file({'plugin': 'cisco'}, None, "db_conn.ini")
CONF_PARSER_OBJ = confp.CiscoConfigParser(CONF_FILE)

View File

@ -27,7 +27,8 @@ import os
from quantum.common.config import find_config_file
from quantum.plugins.cisco.common import cisco_configparser as confp
CP = confp.CiscoConfigParser(find_config_file({}, None, "nexus.ini"))
CP = confp.CiscoConfigParser(find_config_file({'plugin': 'cisco'}, None,
"nexus.ini"))
SECTION = CP['SWITCH']
NEXUS_IP_ADDRESS = SECTION['nexus_ip_address']

View File

@ -41,7 +41,8 @@ from quantum.common.extensions import (PluginAwareExtensionManager,
from quantum.manager import QuantumManager
from quantum.plugins.cisco import l2network_plugin
TEST_CONF_FILE = config.find_config_file({}, None, 'quantum.conf.ciscoext')
TEST_CONF_FILE = config.find_config_file({'plugin': 'cisco'}, None,
'quantum.conf.ciscoext')
EXTENSIONS_PATH = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
os.pardir, os.pardir, os.pardir, "extensions")

View File

@ -23,7 +23,8 @@ import os
from quantum.common.config import find_config_file
from quantum.plugins.cisco.common import cisco_configparser as confp
CP = confp.CiscoConfigParser(find_config_file({}, [], 'ucs.ini'))
CP = confp.CiscoConfigParser(find_config_file({'plugin': 'cisco'}, [],
'ucs.ini'))
SECTION = CP['UCSM']
UCSM_IP_ADDRESS = SECTION['ip_address']
@ -35,7 +36,7 @@ PROFILE_NAME_PREFIX = SECTION['profile_name_prefix']
SECTION = CP['DRIVER']
UCSM_DRIVER = SECTION['name']
CP = confp.CiscoConfigParser(find_config_file({}, [],
CP = confp.CiscoConfigParser(find_config_file({'plugin': 'cisco'}, [],
'ucs_inventory.ini'))
INVENTORY = CP.walk(CP.dummy)

View File

@ -23,7 +23,7 @@ import os
from quantum.common.config import find_config_file
from quantum.plugins.cisco.common import cisco_configparser as confp
CONF_FILE = find_config_file({}, None, "ucs_inventory.ini")
CONF_FILE = find_config_file({'plugin': 'cisco'}, None, "ucs_inventory.ini")
CP = confp.CiscoConfigParser(CONF_FILE)
INVENTORY = CP.walk(CP.dummy)