The oslo config group 'host' masks the 'host' option in the default section

Bug #1866660 reported by Liam Young on 2020-03-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
masakari-monitors
Undecided
Liam Young

Bug Description

The 'host' section in the masakarimonitors.conf seems to override the value of the 'host' key. There are a couple of places in the code that try and access the value of 'hosts' in the DEFAULT section *1, *2 and I expect these are broken.

# cat /etc/masakarimonitors/masakarimonitors.conf
[DEFAULT]
debug = True

[api]
auth_url = https://172.20.0.44:35357

[host]
corosync_multicast_ports = 6405

# python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import masakarimonitors.conf
>>> from masakarimonitors import config
>>> CONF = masakarimonitors.conf.CONF
>>> config.parse_args([])
>>> print(CONF.host.corosync_multicast_ports)
6405
>>> print(CONF.debug)
True
>>> print(CONF.host)
<oslo_config.cfg.ConfigOpts.GroupAttr object at 0x7f4800a33390>

*1 https://github.com/openstack/masakari-monitors/blob/master/masakarimonitors/manager.py#L58
*2 https://github.com/openstack/masakari-monitors/blob/master/masakarimonitors/service.py#L78

Liam Young (gnuoy) on 2020-03-09
Changed in masakari-monitors:
assignee: nobody → Liam Young (gnuoy)

Fix proposed to branch: master
Review: https://review.opendev.org/711953

Changed in masakari-monitors:
status: New → In Progress

Reviewed: https://review.opendev.org/711953
Committed: https://git.openstack.org/cgit/openstack/masakari-monitors/commit/?id=8cb4de9e6535310c6a43fe28f035db9ccb72b383
Submitter: Zuul
Branch: master

commit 8cb4de9e6535310c6a43fe28f035db9ccb72b383
Author: Liam Young <email address hidden>
Date: Mon Mar 9 17:04:50 2020 +0000

    Use hostname to avoid clash with section

    Switch to using 'hostname' rather than 'host' to specify the
    Hostname, FQDN or IP address of this host. This is to avoid a
    clash with a section of the same name *1

    *1 https://github.com/openstack/masakari-monitors/blob/master/masakarimonitors/conf/host.py#L87

    Change-Id: I7d95b063c2eabbd8893857b5e1e7d342db0aebec
    Closes-Bug: #1866660

Changed in masakari-monitors:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers