diff --git a/masakarimonitors/conf/service.py b/masakarimonitors/conf/service.py index 4c3eb19..e234bdd 100644 --- a/masakarimonitors/conf/service.py +++ b/masakarimonitors/conf/service.py @@ -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. diff --git a/masakarimonitors/manager.py b/masakarimonitors/manager.py index f05458e..0f4da72 100644 --- a/masakarimonitors/manager.py +++ b/masakarimonitors/manager.py @@ -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__() diff --git a/masakarimonitors/service.py b/masakarimonitors/service.py index e6ef132..df588a3 100644 --- a/masakarimonitors/service.py +++ b/masakarimonitors/service.py @@ -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._manager """ if not host: - host = CONF.host + host = CONF.hostname if not binary: binary = os.path.basename(sys.argv[0]) diff --git a/releasenotes/notes/bug-1866660-ef8624f5283b2e5e.yaml b/releasenotes/notes/bug-1866660-ef8624f5283b2e5e.yaml new file mode 100644 index 0000000..a5f3128 --- /dev/null +++ b/releasenotes/notes/bug-1866660-ef8624f5283b2e5e.yaml @@ -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.