From 8d0b0dc208e040606b449e460c40a6497661ae03 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Fri, 5 Nov 2021 09:27:02 -0700 Subject: [PATCH] [Admin utils] Also include fwaas.conf in default config files Include /etc/neutron/fwaas.conf in default config files and verify each file exists before using it in the admin util command. Change-Id: Ibd53dcb0824eef89f03c27a9dea9a12aede1d370 --- vmware_nsx/shell/admin/plugins/common/constants.py | 1 + vmware_nsx/shell/nsxadmin.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/shell/admin/plugins/common/constants.py b/vmware_nsx/shell/admin/plugins/common/constants.py index 9bd762329b..8f50460d98 100644 --- a/vmware_nsx/shell/admin/plugins/common/constants.py +++ b/vmware_nsx/shell/admin/plugins/common/constants.py @@ -14,6 +14,7 @@ # Default conf file locations NEUTRON_CONF = '/etc/neutron/neutron.conf' +FWAAS_CONF = '/etc/neutron/fwaas.conf' NSX_INI = '/etc/neutron/plugins/vmware/nsx.ini' # NSX Plugin Constants diff --git a/vmware_nsx/shell/nsxadmin.py b/vmware_nsx/shell/nsxadmin.py index af5768f96e..24a9e26ce7 100644 --- a/vmware_nsx/shell/nsxadmin.py +++ b/vmware_nsx/shell/nsxadmin.py @@ -23,6 +23,7 @@ delete-security-groups, nsx neutron nsxv3 can be options TODO: Autocomplete command line args """ +from os import path import sys from neutron.common import config as neutron_config @@ -59,12 +60,15 @@ def _init_cfg(): # Make sure the default config files are used if not specified in args default_config_files = [constants.NEUTRON_CONF, - constants.NSX_INI] + constants.NSX_INI, + constants.FWAAS_CONF] + config_args = sys.argv[1:] if '--config-file' not in config_args: # Add default config files for file in default_config_files: - config_args.extend(['--config-file', file]) + if path.exists(file): + config_args.extend(['--config-file', file]) # Init the CONF and neutron config (Used by the core plugin) neutron_config.init(args=config_args)