comments should can be on the same line with code

Registered by yaoyuan on 2016-05-27

Problem description
===================
if a comment followed by the config key and conf value, it can not be parsed correctly.

An example
===============
For example, the following configuration i added to /etc/ceilometer/ceilometer.conf

          filter_service_activity = False # Enable if using swift backend

when I run ceilometer, it thrown an exception:

2016-05-26 19:49:39.502 6148 ERROR stevedore.extension [-] Value for option filter_service_activity is not valid: Unexpected boolean value 'False # Enable if using swift backend'
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension Traceback (most recent call last):
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 163, in _load_plugins
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension verify_requirements,
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension File "/usr/local/lib/python2.7/dist-packages/stevedore/named.py", line 123, in _load_one_plugin
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension verify_requirements,
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 188, in _load_one_plugin
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension obj = plugin(*invoke_args, **invoke_kwds)
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension File "/opt/stack/ceilometer/ceilometer/dispatcher/gnocchi.py", line 195, in __init__
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension conf.dispatcher_gnocchi.filter_service_activity)
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line 2946, in __getattr__
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension return self._conf._get(name, self._group)
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line 2567, in _get
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension value = self._do_get(name, group, namespace)
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line 2610, in _do_get
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension % (opt.name, str(ve)))
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension ConfigFileValueError: Value for option filter_service_activity is not valid: Unexpected boolean value 'False # Enable if using swift backend'
2016-05-26 19:49:39.502 6148 ERROR stevedore.extension

Proposed change
===============
Maybe the oslo.config can add a new function to remove all comments behind the configuration and then parse the configuration correctly.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
yaoyuan
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.