Bug 967781 - oslo-config overwrites cli argument values by values from config file
oslo-config overwrites cli argument values by values from config file
Status: CLOSED DUPLICATE of bug 960670
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-oslo-config (Show other bugs)
3.0
Unspecified Unspecified
medium Severity medium
: Upstream M3
: 4.0
Assigned To: Jakub Libosvar
:
Depends On: 989661
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-28 06:34 EDT by Attila Fazekas
Modified: 2016-04-26 11:57 EDT (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-09 10:58:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Attila Fazekas 2013-05-28 06:34:25 EDT
As quantum user the following command logs to the stdout and to the quantum/ server.log, but does not logs to specified logfile.
=====
python /usr/bin/quantum-lbaas-agent --log-file /var/log/quantum/lbaas-agent.log --config-file /etc/quantum/quantum.conf --config-file /etc/quantum/lbaas_agent.ini --debug --verbose
2013-05-28 10:28:29  WARNING [quantum.agent.common.config] Deprecated: DEFAULT.root_helper is deprecated! Please move root_helper configuration to [AGENT] section.
2013-05-28 10:28:29  WARNING [quantum.agent.common.config] Deprecated: DEFAULT.root_helper is deprecated! Please move root_helper configuration to [AGENT] section.

I do not have any other log file in the /var/log/quantum/.
=====
$ ls /var/log/quantum/
server.log


The init scripts are using similar commands for starting the services.
I have the same issue with all other agents.
Comment 2 Jaroslav Henner 2013-05-28 18:02:16 EDT
Well if I start it by init script, it does log to
/var/log/quantum/lbaas-agent.log
Comment 3 Ryan O'Hara 2013-07-19 11:17:06 EDT
Is log_file being set in quantum.conf? It seems that --log-file will be ignored if log_file is set in quantum.conf.

# egrep ^log_file /etc/quantum/quantum.conf 
log_file=/tmp/quantum.log

# quantum-lbaas-agent --log-file /var/log/quantum/lbaas-agent.log --config-file /etc/quantum/quantum.conf --config-file /etc/quantum/lbaas_agent.ini --debug --verbose
2013-07-19 10:14:48     INFO [quantum.common.config] Logging enabled!
2013-07-19 10:14:48     INFO [quantum.openstack.common.rpc.impl_qpid] Connected to AMQP server on 10.15.85.141:5672
2013-07-19 10:14:48     INFO [quantum.openstack.common.rpc.impl_qpid] Connected to AMQP server on 10.15.85.141:5672

# cat /var/log/quantum/lbaas-agent.log
cat: /var/log/quantum/lbaas-agent.log: No such file or directory

# cat /tmp/quantum.log 
2013-07-19 10:14:48     INFO [quantum.common.config] Logging enabled!
2013-07-19 10:14:48     INFO [quantum.openstack.common.rpc.impl_qpid] Connected to AMQP server on 10.15.85.141:5672
2013-07-19 10:14:48     INFO [quantum.openstack.common.rpc.impl_qpid] Connected to AMQP server on 10.15.85.141:5672
2013-07-19 10:15:21     INFO [quantum.openstack.common.service] Caught SIGINT, exiting

Note that if log_file is *not* set in quantum.conf, quantum-lbaas-agent will log to the file given via --log-file.
Comment 6 Ryan O'Hara 2013-07-29 13:27:20 EDT
This is only a bug if the command-line option "--log-file" is expected to take precedence over the "log_file" parameter in the config file.
Comment 7 Attila Fazekas 2013-08-09 01:23:55 EDT
Yes my expectation is the command-line options always takes precedence to anything else.

1. CLI options
2. Environment variables
3. Configuration file
(4. distribution defaults)
5. Application defaults
Comment 8 Rami Vaknin 2013-11-06 05:54:22 EST
I've tested this scenario in rhos 4.0 on rhel 6.5 (puddle 2013-10-28.2), I've installed the env using packstack and my neutron.conf be default mentions only the log_dir (which is /var/log/neutron) so by default all the agents logs are written well and in the right location:

# ll /var/log/neutron/
total 116
-rw-r--r--. 1 neutron neutron  9392 Nov  6 12:21 l3-agent.log
-rw-r--r--. 1 neutron neutron  2977 Nov  6 12:50 lbaas-agent.log
-rw-r--r--. 1 neutron neutron   154 Nov  6 12:11 metadata-agent.log
-rw-r--r--. 1 root    root       77 Nov  6 12:12 neutron-ns-metadata-proxy-e6e9549f-e6a9-4070-9df1-6a1f332aecb0.log
-rw-r--r--. 1 neutron neutron 15686 Nov  6 12:21 openvswitch-agent.log
-rw-r--r--. 1 neutron neutron   266 Nov  6 12:11 ovs-cleanup.log
-rw-r--r--. 1 neutron neutron 66489 Nov  6 12:50 server.log


I tried to add log_file to the neutron.conf, it indeed looks like a bug - the process' "--config-file" is ignored and the logging are written to the location specified in neutron.conf.
Comment 9 Jakub Libosvar 2013-11-18 12:57:37 EST
This issue is more severe, it's not related to lbaas but to config that's used by all agents.
Comment 10 Jakub Libosvar 2013-11-19 10:03:23 EST
According https://bugs.launchpad.net/oslo/+bug/1176817/comments/2 this is expected behavior. 

If you pass arguments --foo bar --config-file baz.conf and in baz.conf is defined foo=baz, then bar value will be overwritten by baz.

If you pass arguments in different order: --config-file baz.conf --foo bar, then foo will have value bar.

Changing component to oslo to decide whether this is bug or not.
Comment 12 Flavio Percoco 2013-12-09 10:58:40 EST

*** This bug has been marked as a duplicate of bug 960670 ***

Note You need to log in before you can comment on or make changes to this bug.