Debug paramter using wrong type

Bug #1719929 reported by Juan Antonio Osorio Robles
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.config
Won't Fix
Undecided
Unassigned
puppet-oslo
Fix Released
Medium
Alex Schultz
tripleo
Fix Released
High
Ade Lee

Bug Description

The Debug heat parameter is used in many services templates to set whether logging should be verbose or not. It is currently of type string and defaults to an empty string ('').

This works for several services (such as keystone), since the historical debug option was moved to the logging resource, and the original value (which we set in tripleo) is ignored thanks to the pick function:

https://github.com/openstack/puppet-keystone/blob/master/manifests/logging.pp#L136

This, however, breaks for services that use the value as-is. such as barbican:

https://github.com/openstack/puppet-barbican/blob/master/manifests/api/logging.pp#L119

Since it ends up with an invalid value in oslo.log

debug=

that, if we try to use it, breaks the service:

[Fri Sep 22 21:49:09.233707 2017] [:error] [pid 19] argument --debug: Invalid Boolean value:
[Fri Sep 22 21:49:09.233912 2017] [:error] [pid 19] [remote 172.16.2.7:164] mod_wsgi (pid=19): Target WSGI script '/v
ar/www/cgi-bin/barbican/main' cannot be loaded as Python module.
[Fri Sep 22 21:49:09.233942 2017] [:error] [pid 19] [remote 172.16.2.7:164] mod_wsgi (pid=19): SystemExit exception r
aised by WSGI script '/var/www/cgi-bin/barbican/main' ignored.
[Fri Sep 22 21:49:09.233972 2017] [:error] [pid 19] [remote 172.16.2.7:164] Traceback (most recent call last):
[Fri Sep 22 21:49:09.233996 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/var/www/cgi-bin/barbican/main",
line 24, in <module>
[Fri Sep 22 21:49:09.234101 2017] [:error] [pid 19] [remote 172.16.2.7:164] from barbican.api import app
[Fri Sep 22 21:49:09.234116 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/usr/lib/python2.7/site-packages/
barbican/api/__init__.py", line 25, in <module>
[Fri Sep 22 21:49:09.234251 2017] [:error] [pid 19] [remote 172.16.2.7:164] from barbican.common import config
[Fri Sep 22 21:49:09.234270 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/usr/lib/python2.7/site-packages/
barbican/common/config.py", line 342, in <module>
[Fri Sep 22 21:49:09.234507 2017] [:error] [pid 19] [remote 172.16.2.7:164] parse_args(CONF)
[Fri Sep 22 21:49:09.234524 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/usr/lib/python2.7/site-packages/
barbican/common/config.py", line 243, in parse_args
[Fri Sep 22 21:49:09.234550 2017] [:error] [pid 19] [remote 172.16.2.7:164] default_config_files=default_config_f
iles)
[Fri Sep 22 21:49:09.234559 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/usr/lib/python2.7/site-packages/
oslo_config/cfg.py", line 2468, in __call__
[Fri Sep 22 21:49:09.235776 2017] [:error] [pid 19] [remote 172.16.2.7:164] else sys.argv[1:])
[Fri Sep 22 21:49:09.235798 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/usr/lib/python2.7/site-packages/
oslo_config/cfg.py", line 3151, in _parse_cli_opts
[Fri Sep 22 21:49:09.235823 2017] [:error] [pid 19] [remote 172.16.2.7:164] return self._parse_config_files()
[Fri Sep 22 21:49:09.235832 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/usr/lib/python2.7/site-packages/
oslo_config/cfg.py", line 3189, in _parse_config_files
[Fri Sep 22 21:49:09.235846 2017] [:error] [pid 19] [remote 172.16.2.7:164] self._validate_cli_options(namespace)
[Fri Sep 22 21:49:09.235853 2017] [:error] [pid 19] [remote 172.16.2.7:164] File "/usr/lib/python2.7/site-packages/
oslo_config/cfg.py", line 3209, in _validate_cli_options
[Fri Sep 22 21:49:09.235866 2017] [:error] [pid 19] [remote 172.16.2.7:164] raise SystemExit
[Fri Sep 22 21:49:09.235889 2017] [:error] [pid 19] [remote 172.16.2.7:164] SystemExit

This seems to be an error on two fronts:

* We should pass a value of the correct type in tripleo-heat-templates

* We should validate the value correct in puppet-oslo.

Changed in tripleo:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Ade Lee (alee-3)
Revision history for this message
Alex Schultz (alex-schultz) wrote :

I added oslo.log because I believe it shouldn't error on debug=. There is an issue with puppet-oslo not handling '' correctly but there's a few different things wrong with this

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-oslo (master)

Fix proposed to branch: master
Review: https://review.openstack.org/507901

Changed in puppet-oslo:
assignee: nobody → Alex Schultz (alex-schultz)
status: New → In Progress
Revision history for this message
Ben Nemec (bnemec) wrote :

From the oslo side, this is oslo.config's type validation throwing an error, not oslo.log. Strictly speaking it is correct to do so. An empty value in a config file results in a None value, and None is not a boolean:

>>> type(False)
<type 'bool'>
>>> type(None)
<type 'NoneType'>

None does evaluate to False so we could probably allow it in the boolean type check, but I kind of feel like passing anything other than True or False to a boolean option is a legitimate bug and it should be an error.

That said, I'm open to further discussion. I don't think allowing None as a boolean value would be horrible so if there's enough desire to do it I'd be okay with that.

no longer affects: oslo.log
Changed in puppet-oslo:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (master)

Fix proposed to branch: master
Review: https://review.openstack.org/507935

Changed in tripleo:
status: Triaged → In Progress
Changed in tripleo:
milestone: none → queens-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-oslo (master)

Reviewed: https://review.openstack.org/507901
Committed: https://git.openstack.org/cgit/openstack/puppet-oslo/commit/?id=70816f417a324596961fee087a71b562f3c13001
Submitter: Jenkins
Branch: master

commit 70816f417a324596961fee087a71b562f3c13001
Author: Alex Schultz <email address hidden>
Date: Wed Sep 27 09:40:11 2017 -0600

    Ensure debug is a boolean

    Use any2bool when the debug value for logging is not the class defaults
    to ensure that we pass a true boolean to the configuration file.

    Change-Id: Ica3cbb2ca6b1168a49448ace1a38c96d95cdcd88
    Closes-Bug: #1719929

Changed in puppet-oslo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (master)

Reviewed: https://review.openstack.org/507935
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=c9b7091536ad835634406c92db100bd186c6425d
Submitter: Jenkins
Branch: master

commit c9b7091536ad835634406c92db100bd186c6425d
Author: Ade Lee <email address hidden>
Date: Wed Sep 27 13:04:49 2017 -0400

    Ensure Debug is a boolean

    Oslo does not like it when Debug is not a proper python boolean
    Closes-Bug: 1719929

    Change-Id: Ib6c3969d4dd75d5fb2cc274266c060acff8d5571

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 8.0.0.0b1

This issue was fixed in the openstack/tripleo-heat-templates 8.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/puppet-oslo 12.0.0

This issue was fixed in the openstack/puppet-oslo 12.0.0 release.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

I think the current behavior is correct. Please reopen the bug if you disagree and want to work on a change to the parser to support an empty value.

Changed in oslo.config:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.