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
This commit is contained in:
Liam Young 2020-03-09 17:04:50 +00:00
parent b717be163e
commit 8cb4de9e65
4 changed files with 16 additions and 4 deletions

View File

@ -17,8 +17,9 @@ import socket
from oslo_config import cfg
service_opts = [
cfg.StrOpt('host',
cfg.StrOpt('hostname',
default=socket.gethostname(),
deprecated_name="host",
help='''
Hostname, FQDN or IP address of this host. Must be valid within AMQP key.

View File

@ -55,7 +55,7 @@ class Manager(PeriodicTasks):
def __init__(self, host=None, service_name='undefined'):
if not host:
host = CONF.host
host = CONF.hostname
self.host = host
self.service_name = service_name
super(Manager, self).__init__()

View File

@ -69,13 +69,13 @@ class Service(service.Service):
def create(cls, host=None, binary=None, manager=None):
"""Instantiates class and passes back application object.
:param host: defaults to CONF.host
:param host: defaults to CONF.hostname
:param binary: defaults to basename of executable
:param manager: defaults to CONF.<Latter part of binary>_manager
"""
if not host:
host = CONF.host
host = CONF.hostname
if not binary:
binary = os.path.basename(sys.argv[0])

View File

@ -0,0 +1,11 @@
---
features:
- |
A 'hostname' option has been added to the Masakari monitors configuration
file which replaces the 'host' option. The option should be used to specify
the Hostname, FQDN or IP address of the host.
deprecations:
- |
The 'host' option in the 'DEFAULT' section has been deprecated as it
clashes with the name of a section in the same file. It has been replaced
by the 'hostname' option.