Fix custom conf files referencing

The cli args neutron-conf/nsx-conf we had until this
point to conf files not in the default locations didn't
work. This is because of the below code section,
https://github.com/openstack/oslo.config/blob/master/oslo_config/cfg.py#L2580

the above states reloading the conf options only from the
ones passed as --config-file. So that's the only way to pass
new config files to oslo.config.

So if someone wants to pass a custom neutron.conf/nsx.ini to
admin utility, they can do:
nsxadmin --config-file custom_path/neutron.conf --config-file
custom_path/nsx.ini -r <resource> -o <operation>

This patch removes neutron_conf and nsx_conf options from the cli
and users should use --config-file option to specify any config files.

Change-Id: Ia5048875fd465d46aa6f85cd02278d778eb6017e
This commit is contained in:
Akash Gangil 2015-12-05 03:28:25 -08:00
parent 874b1127a9
commit 215d21dc04
2 changed files with 7 additions and 10 deletions
tools/python_nsxadmin/admin
plugins/common
shell.py

@ -12,6 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
# Default conf file locations
NEUTRON_CONF = '/etc/neutron/neutron.conf'
NSX_INI = '/etc/neutron/plugins/vmware/nsx.ini'
# NSX Plugin Constants
NSXV3_PLUGIN = 'vmware_nsx.plugin.NsxV3Plugin'
NSXV_PLUGIN = 'vmware_nsx.plugin.NsxVPlugin'

@ -114,13 +114,7 @@ def _get_resources():
modules)
cli_opts = [cfg.StrOpt('neutron-conf',
default='/etc/neutron/neutron.conf',
help='Neutron configuration file'),
cfg.StrOpt('nsx-conf',
default='/etc/neutron/plugins/vmware/nsx.ini',
help='NSX configuration file'),
cfg.StrOpt('fmt',
cli_opts = [cfg.StrOpt('fmt',
short='f',
default='psql',
choices=['psql', 'json'],
@ -169,8 +163,8 @@ def _init_cfg():
prog='Admin Utility',
version=version.__version__,
usage='nsxadmin -r <resources> -o <operation>',
default_config_files=[cfg.CONF.neutron_conf,
cfg.CONF.nsx_conf])
default_config_files=[constants.NEUTRON_CONF,
constants.NSX_INI])
def _validate_resource_choice(resource, nsx_plugin):
@ -205,7 +199,6 @@ def _validate_op_choice(choice, nsx_plugin):
def main(argv=sys.argv[1:]):
_init_cfg()
_init_resource_plugin()
nsx_plugin_in_use = _get_plugin()
LOG.info(_LI('NSX Plugin in use: %s'), nsx_plugin_in_use)