From 5defcd0aa61b96933369a545040e57d9665add7a Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Thu, 31 Jul 2014 13:27:57 +1000 Subject: [PATCH] Remove unused arg to config.setup_logging() The cfg.CFG argument is ignored and misleading. This change removes it and updates all callers. Closes-Bug: #1355565 Change-Id: I2fcece85d1abe848e5c01125cfb62c02f2dcbc86 --- neutron/agent/dhcp_agent.py | 2 +- neutron/agent/l3_agent.py | 2 +- neutron/agent/metadata/agent.py | 2 +- neutron/agent/metadata/namespace_proxy.py | 2 +- neutron/agent/netns_cleanup_util.py | 2 +- neutron/agent/ovs_cleanup_util.py | 2 +- neutron/cmd/sanity_check.py | 2 +- neutron/cmd/usage_audit.py | 4 +--- neutron/common/config.py | 7 ++----- neutron/debug/shell.py | 2 +- neutron/plugins/bigswitch/agent/restproxy_agent.py | 2 +- neutron/plugins/cisco/cfg_agent/cfg_agent.py | 2 +- neutron/plugins/hyperv/agent/hyperv_neutron_agent.py | 2 +- neutron/plugins/ibm/agent/sdnve_neutron_agent.py | 2 +- .../plugins/linuxbridge/agent/linuxbridge_neutron_agent.py | 2 +- neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py | 2 +- neutron/plugins/mlnx/agent/eswitch_neutron_agent.py | 2 +- neutron/plugins/nec/agent/nec_neutron_agent.py | 2 +- neutron/plugins/ofagent/agent/main.py | 2 +- neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py | 2 +- neutron/plugins/openvswitch/agent/ovs_neutron_agent.py | 2 +- neutron/plugins/ryu/agent/ryu_neutron_agent.py | 2 +- neutron/plugins/sriovnicagent/sriov_nic_agent.py | 2 +- neutron/plugins/vmware/check_nsx_config.py | 2 +- neutron/service.py | 2 +- neutron/services/firewall/agents/varmour/varmour_router.py | 2 +- neutron/services/loadbalancer/agent/agent.py | 2 +- neutron/services/metering/agents/metering_agent.py | 2 +- neutron/tests/functional/agent/linux/test_ip_lib.py | 2 +- neutron/tests/functional/agent/linux/test_keepalived.py | 2 +- neutron/tests/functional/agent/test_l3_agent.py | 2 +- 31 files changed, 32 insertions(+), 37 deletions(-) diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index fc0fccc3a..5a501faa9 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -613,7 +613,7 @@ def register_options(): def main(): register_options() common_config.init(sys.argv[1:]) - config.setup_logging(cfg.CONF) + config.setup_logging() server = neutron_service.Service.create( binary='neutron-dhcp-agent', topic=topics.DHCP_AGENT, diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index f632996d2..99262d78c 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -1913,7 +1913,7 @@ def _register_opts(conf): def main(manager='neutron.agent.l3_agent.L3NATAgentWithStateReport'): _register_opts(cfg.CONF) common_config.init(sys.argv[1:]) - config.setup_logging(cfg.CONF) + config.setup_logging() server = neutron_service.Service.create( binary='neutron-l3-agent', topic=topics.L3_AGENT, diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index c5b572154..3381f1492 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -386,7 +386,7 @@ def main(): cfg.CONF.set_default(name='cache_url', default='memory://?default_ttl=5') agent_conf.register_agent_state_opts_helper(cfg.CONF) config.init(sys.argv[1:]) - config.setup_logging(cfg.CONF) + config.setup_logging() utils.log_opt_values(LOG) proxy = UnixDomainMetadataProxy(cfg.CONF) proxy.run() diff --git a/neutron/agent/metadata/namespace_proxy.py b/neutron/agent/metadata/namespace_proxy.py index c6a58c2ec..9325fdd61 100644 --- a/neutron/agent/metadata/namespace_proxy.py +++ b/neutron/agent/metadata/namespace_proxy.py @@ -169,7 +169,7 @@ def main(): cfg.CONF.register_cli_opts(opts) # Don't get the default configuration file cfg.CONF(project='neutron', default_config_files=[]) - config.setup_logging(cfg.CONF) + config.setup_logging() utils.log_opt_values(LOG) proxy = ProxyDaemon(cfg.CONF.pid_file, cfg.CONF.metadata_port, diff --git a/neutron/agent/netns_cleanup_util.py b/neutron/agent/netns_cleanup_util.py index 292c179ad..771a77f5d 100644 --- a/neutron/agent/netns_cleanup_util.py +++ b/neutron/agent/netns_cleanup_util.py @@ -159,7 +159,7 @@ def main(): """ conf = setup_conf() conf() - config.setup_logging(conf) + config.setup_logging() root_helper = agent_config.get_root_helper(conf) # Identify namespaces that are candidates for deletion. diff --git a/neutron/agent/ovs_cleanup_util.py b/neutron/agent/ovs_cleanup_util.py index 1179f103d..83337205b 100644 --- a/neutron/agent/ovs_cleanup_util.py +++ b/neutron/agent/ovs_cleanup_util.py @@ -81,7 +81,7 @@ def main(): conf = setup_conf() conf() - config.setup_logging(conf) + config.setup_logging() configuration_bridges = set([conf.ovs_integration_bridge, conf.external_network_bridge]) diff --git a/neutron/cmd/sanity_check.py b/neutron/cmd/sanity_check.py index b6522d6d7..4b1be1bb7 100644 --- a/neutron/cmd/sanity_check.py +++ b/neutron/cmd/sanity_check.py @@ -114,7 +114,7 @@ def all_tests_passed(): def main(): cfg.CONF.register_cli_opts(OPTS) cfg.CONF.set_override('use_stderr', True) - config.setup_logging(cfg.CONF) + config.setup_logging() config.init(sys.argv[1:], default_config_files=[]) if cfg.CONF.config_file: diff --git a/neutron/cmd/usage_audit.py b/neutron/cmd/usage_audit.py index 78ee7c781..d089c6645 100644 --- a/neutron/cmd/usage_audit.py +++ b/neutron/cmd/usage_audit.py @@ -21,8 +21,6 @@ subnets. import sys -from oslo.config import cfg - from neutron.common import config from neutron.common import rpc as n_rpc from neutron import context @@ -31,7 +29,7 @@ from neutron import manager def main(): config.init(sys.argv[1:]) - config.setup_logging(cfg.CONF) + config.setup_logging() cxt = context.get_admin_context() plugin = manager.NeutronManager.get_plugin() diff --git a/neutron/common/config.py b/neutron/common/config.py index 14429cee5..cda8d0503 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -157,11 +157,8 @@ def init(args, **kwargs): raise Exception(msg) -def setup_logging(conf): - """Sets up the logging options for a log with supplied name. - - :param conf: a cfg.ConfOpts object - """ +def setup_logging(): + """Sets up the logging options for a log with supplied name.""" product_name = "neutron" logging.setup(product_name) LOG.info(_("Logging enabled!")) diff --git a/neutron/debug/shell.py b/neutron/debug/shell.py index fb37bde7d..733f0398e 100644 --- a/neutron/debug/shell.py +++ b/neutron/debug/shell.py @@ -76,7 +76,7 @@ class NeutronDebugShell(shell.NeutronShell): config.register_use_namespaces_opts_helper(cfg.CONF) config.register_root_helper(cfg.CONF) cfg.CONF(['--config-file', self.options.config_file]) - config.setup_logging(cfg.CONF) + config.setup_logging() driver = importutils.import_object(cfg.CONF.interface_driver, cfg.CONF) self.debug_agent = debug_agent.NeutronDebugAgent(cfg.CONF, client, diff --git a/neutron/plugins/bigswitch/agent/restproxy_agent.py b/neutron/plugins/bigswitch/agent/restproxy_agent.py index caf57e4bf..8fb6cdf12 100644 --- a/neutron/plugins/bigswitch/agent/restproxy_agent.py +++ b/neutron/plugins/bigswitch/agent/restproxy_agent.py @@ -166,7 +166,7 @@ class RestProxyAgent(n_rpc.RpcCallback, def main(): config.init(sys.argv[1:]) - config.setup_logging(cfg.CONF) + config.setup_logging() pl_config.register_config() integ_br = cfg.CONF.RESTPROXYAGENT.integration_bridge diff --git a/neutron/plugins/cisco/cfg_agent/cfg_agent.py b/neutron/plugins/cisco/cfg_agent/cfg_agent.py index a1ae4d8db..f204952be 100644 --- a/neutron/plugins/cisco/cfg_agent/cfg_agent.py +++ b/neutron/plugins/cisco/cfg_agent/cfg_agent.py @@ -343,7 +343,7 @@ def main(manager='neutron.plugins.cisco.cfg_agent.' conf.register_opts(external_process.OPTS) common_config.init(sys.argv[1:]) conf(project='neutron') - config.setup_logging(conf) + config.setup_logging() server = neutron_service.Service.create( binary='neutron-cisco-cfg-agent', topic=c_constants.CFG_AGENT, diff --git a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py index 6fd00e38e..a41cb4a4e 100644 --- a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py +++ b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py @@ -464,7 +464,7 @@ class HyperVNeutronAgent(n_rpc.RpcCallback): def main(): common_config.init(sys.argv[1:]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() plugin = HyperVNeutronAgent() diff --git a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py index 08d5a08bb..e2121bf7b 100644 --- a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py +++ b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py @@ -254,7 +254,7 @@ def create_agent_config_map(config): def main(): cfg.CONF.register_opts(ip_lib.OPTS) common_config.init(sys.argv[1:]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() try: agent_config = create_agent_config_map(cfg.CONF) diff --git a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py index 9af0c105f..7d608c3e6 100755 --- a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -1018,7 +1018,7 @@ class LinuxBridgeNeutronAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin): def main(): common_config.init(sys.argv[1:]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() try: interface_mappings = q_utils.parse_mappings( cfg.CONF.LINUX_BRIDGE.physical_interface_mappings) diff --git a/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py b/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py index 8f08175cb..28b7fcfe3 100644 --- a/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py +++ b/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py @@ -331,7 +331,7 @@ class ApicTopologyAgent(manager.Manager): def launch(binary, manager, topic=None): cfg.CONF(project='neutron') common_cfg.init(sys.argv[1:]) - config.setup_logging(cfg.CONF) + config.setup_logging() report_period = cfg.CONF.ml2_cisco_apic.apic_agent_report_interval poll_period = cfg.CONF.ml2_cisco_apic.apic_agent_poll_interval server = service.Service.create( diff --git a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py index cdacb9caa..3bae841fe 100644 --- a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py +++ b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py @@ -398,7 +398,7 @@ class MlnxEswitchNeutronAgent(sg_rpc.SecurityGroupAgentRpcMixin): def main(): common_config.init(sys.argv[1:]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() try: interface_mappings = q_utils.parse_mappings( diff --git a/neutron/plugins/nec/agent/nec_neutron_agent.py b/neutron/plugins/nec/agent/nec_neutron_agent.py index 241503afc..4060305b0 100755 --- a/neutron/plugins/nec/agent/nec_neutron_agent.py +++ b/neutron/plugins/nec/agent/nec_neutron_agent.py @@ -235,7 +235,7 @@ class NECNeutronAgent(object): def main(): common_config.init(sys.argv[1:]) - common_config.setup_logging(config.CONF) + common_config.setup_logging() # Determine which agent type to use. integ_br = config.OVS.integration_bridge diff --git a/neutron/plugins/ofagent/agent/main.py b/neutron/plugins/ofagent/agent/main.py index df000f051..62332bf82 100755 --- a/neutron/plugins/ofagent/agent/main.py +++ b/neutron/plugins/ofagent/agent/main.py @@ -35,5 +35,5 @@ def main(): # TODO(yamamoto) remove this later if ryu_cfg.CONF is not cfg.CONF: ryu_cfg.CONF(project='ryu', args=[]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() AppManager.run_apps(['neutron.plugins.ofagent.agent.ofa_neutron_agent']) diff --git a/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py b/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py index 674cc197a..6181a4443 100644 --- a/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py +++ b/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py @@ -164,7 +164,7 @@ class NVSDNeutronAgent(n_rpc.RpcCallback): def main(): common_config.init(sys.argv[1:]) - common_config.setup_logging(config.CONF) + common_config.setup_logging() integ_br = config.AGENT.integration_bridge root_helper = config.AGENT.root_helper diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index b176b9417..c0d054e93 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -1520,7 +1520,7 @@ def create_agent_config_map(config): def main(): cfg.CONF.register_opts(ip_lib.OPTS) common_config.init(sys.argv[1:]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() q_utils.log_opt_values(LOG) try: diff --git a/neutron/plugins/ryu/agent/ryu_neutron_agent.py b/neutron/plugins/ryu/agent/ryu_neutron_agent.py index dfe9e4ddc..615e2e931 100755 --- a/neutron/plugins/ryu/agent/ryu_neutron_agent.py +++ b/neutron/plugins/ryu/agent/ryu_neutron_agent.py @@ -283,7 +283,7 @@ class OVSNeutronOFPRyuAgent(n_rpc.RpcCallback, def main(): common_config.init(sys.argv[1:]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() integ_br = cfg.CONF.OVS.integration_bridge polling_interval = cfg.CONF.AGENT.polling_interval diff --git a/neutron/plugins/sriovnicagent/sriov_nic_agent.py b/neutron/plugins/sriovnicagent/sriov_nic_agent.py index 886269307..dbfc03c73 100644 --- a/neutron/plugins/sriovnicagent/sriov_nic_agent.py +++ b/neutron/plugins/sriovnicagent/sriov_nic_agent.py @@ -322,7 +322,7 @@ class SriovNicAgentConfigParser(object): def main(): common_config.init(sys.argv[1:]) - common_config.setup_logging(cfg.CONF) + common_config.setup_logging() try: config_parser = SriovNicAgentConfigParser() config_parser.parse() diff --git a/neutron/plugins/vmware/check_nsx_config.py b/neutron/plugins/vmware/check_nsx_config.py index cb0721edb..a063394c1 100644 --- a/neutron/plugins/vmware/check_nsx_config.py +++ b/neutron/plugins/vmware/check_nsx_config.py @@ -24,7 +24,7 @@ from neutron.plugins.vmware.common import config as nsx_config # noqa from neutron.plugins.vmware.common import nsx_utils from neutron.plugins.vmware import nsxlib -config.setup_logging(cfg.CONF) +config.setup_logging() def help(name): diff --git a/neutron/service.py b/neutron/service.py index cf357d16f..34d7f5295 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -88,7 +88,7 @@ class NeutronApiService(WsgiService): # flags. Everything else must be set up in the conf file... # Log the options used when starting if we're in debug mode... - config.setup_logging(cfg.CONF) + config.setup_logging() # Dump the initial option values cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) service = cls(app_name) diff --git a/neutron/services/firewall/agents/varmour/varmour_router.py b/neutron/services/firewall/agents/varmour/varmour_router.py index e496f119f..3c36f7e90 100755 --- a/neutron/services/firewall/agents/varmour/varmour_router.py +++ b/neutron/services/firewall/agents/varmour/varmour_router.py @@ -339,7 +339,7 @@ def main(): conf.register_opts(interface.OPTS) conf.register_opts(external_process.OPTS) common_config.init(sys.argv[1:]) - config.setup_logging(conf) + config.setup_logging() server = neutron_service.Service.create( binary='neutron-l3-agent', topic=topics.L3_AGENT, diff --git a/neutron/services/loadbalancer/agent/agent.py b/neutron/services/loadbalancer/agent/agent.py index 0434c688c..c6e4f68bc 100644 --- a/neutron/services/loadbalancer/agent/agent.py +++ b/neutron/services/loadbalancer/agent/agent.py @@ -59,7 +59,7 @@ def main(): config.register_root_helper(cfg.CONF) common_config.init(sys.argv[1:]) - config.setup_logging(cfg.CONF) + config.setup_logging() mgr = manager.LbaasAgentManager(cfg.CONF) svc = LbaasAgentService( diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index 2747fe842..c22c80b8a 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -286,7 +286,7 @@ def main(): config.register_agent_state_opts_helper(conf) config.register_root_helper(conf) common_config.init(sys.argv[1:]) - config.setup_logging(conf) + config.setup_logging() server = neutron_service.Service.create( binary='neutron-metering-agent', topic=topics.METERING_AGENT, diff --git a/neutron/tests/functional/agent/linux/test_ip_lib.py b/neutron/tests/functional/agent/linux/test_ip_lib.py index c3bd0853d..8473bbddc 100644 --- a/neutron/tests/functional/agent/linux/test_ip_lib.py +++ b/neutron/tests/functional/agent/linux/test_ip_lib.py @@ -36,7 +36,7 @@ class IpLibTestFramework(base.BaseLinuxTestCase): self._configure() def _configure(self): - config.setup_logging(cfg.CONF) + config.setup_logging() config.register_root_helper(cfg.CONF) cfg.CONF.set_override('root_helper', self.root_helper, group='AGENT') config.register_interface_driver_opts_helper(cfg.CONF) diff --git a/neutron/tests/functional/agent/linux/test_keepalived.py b/neutron/tests/functional/agent/linux/test_keepalived.py index d37a798da..79182671a 100644 --- a/neutron/tests/functional/agent/linux/test_keepalived.py +++ b/neutron/tests/functional/agent/linux/test_keepalived.py @@ -34,7 +34,7 @@ class KeepalivedManagerTestCase(functional_base.BaseSudoTestCase, def _configure(self): cfg.CONF.set_override('debug', True) - config.setup_logging(cfg.CONF) + config.setup_logging() config.register_root_helper(cfg.CONF) cfg.CONF.set_override('root_helper', self.root_helper, group='AGENT') diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py index b5687c9cf..696149b7a 100644 --- a/neutron/tests/functional/agent/test_l3_agent.py +++ b/neutron/tests/functional/agent/test_l3_agent.py @@ -39,7 +39,7 @@ class L3AgentTestFramework(base.BaseOVSLinuxTestCase): def _configure(self): l3_agent._register_opts(cfg.CONF) cfg.CONF.set_override('debug', True) - config.setup_logging(cfg.CONF) + config.setup_logging() cfg.CONF.set_override( 'interface_driver', 'neutron.agent.linux.interface.OVSInterfaceDriver') -- 2.45.2