Add the api config opts in groups to deal with the single heat.conf
So first off, I also don't like the replicating of the api_opts in wsgi.py but if I don't do that the sample generator doesn't work:( We add the wsgi options into a group for each of the api servers with the deprecated group of "DEFAULT" so it still deals with the flat layout. The behaviour is as follows (assuming heat-api): 1) if you have both (/etc/heat/{heat.conf, heat-api.conf} the value in heat-api.conf wins over heat.conf 2) if you have just one of the config files but a value in both the [DEFAULT] section and the [heat-api] section then the value in heat-api wins. bug #1209141 Change-Id: I66ddb3dca91d13b28e68dfb4306e94eb4e537fa7
This commit is contained in:
parent
b6f4bea473
commit
0d083f972a
@ -56,11 +56,11 @@ if __name__ == '__main__':
|
||||
|
||||
app = config.load_paste_app()
|
||||
|
||||
port = cfg.CONF.bind_port
|
||||
host = cfg.CONF.bind_host
|
||||
port = cfg.CONF.heat_api.bind_port
|
||||
host = cfg.CONF.heat_api.bind_host
|
||||
LOG.info('Starting Heat ReST API on %s:%s' % (host, port))
|
||||
server = wsgi.Server()
|
||||
server.start(app, cfg.CONF, default_port=port)
|
||||
server.start(app, cfg.CONF.heat_api, default_port=port)
|
||||
server.wait()
|
||||
except RuntimeError as e:
|
||||
sys.exit("ERROR: %s" % e)
|
||||
|
@ -58,11 +58,11 @@ if __name__ == '__main__':
|
||||
|
||||
app = config.load_paste_app()
|
||||
|
||||
port = cfg.CONF.bind_port
|
||||
host = cfg.CONF.bind_host
|
||||
port = cfg.CONF.heat_api_cfn.bind_port
|
||||
host = cfg.CONF.heat_api_cfn.bind_host
|
||||
LOG.info('Starting Heat API on %s:%s' % (host, port))
|
||||
server = wsgi.Server()
|
||||
server.start(app, cfg.CONF, default_port=port)
|
||||
server.start(app, cfg.CONF.heat_api_cfn, default_port=port)
|
||||
server.wait()
|
||||
except RuntimeError as e:
|
||||
sys.exit("ERROR: %s" % e)
|
||||
|
@ -58,11 +58,11 @@ if __name__ == '__main__':
|
||||
|
||||
app = config.load_paste_app()
|
||||
|
||||
port = cfg.CONF.bind_port
|
||||
host = cfg.CONF.bind_host
|
||||
port = cfg.CONF.heat_api_cloudwatch.bind_port
|
||||
host = cfg.CONF.heat_api_cloudwatch.bind_host
|
||||
LOG.info('Starting Heat CloudWatch API on %s:%s' % (host, port))
|
||||
server = wsgi.Server()
|
||||
server.start(app, cfg.CONF, default_port=port)
|
||||
server.start(app, cfg.CONF.heat_api_cloudwatch, default_port=port)
|
||||
server.wait()
|
||||
except RuntimeError as e:
|
||||
sys.exit("ERROR: %s" % e)
|
||||
|
@ -64,33 +64,6 @@
|
||||
#auth_encryption_key=notgood but just long enough i think
|
||||
|
||||
|
||||
#
|
||||
# Options defined in heat.common.wsgi
|
||||
#
|
||||
|
||||
# Address to bind the server. Useful when selecting a
|
||||
# particular network interface. (string value)
|
||||
#bind_host=0.0.0.0
|
||||
|
||||
# The port on which the server will listen. (integer value)
|
||||
#bind_port=<None>
|
||||
|
||||
# Number of backlog requests to configure the socket with
|
||||
# (integer value)
|
||||
#backlog=4096
|
||||
|
||||
# Location of the SSL Certificate File to use for SSL mode
|
||||
# (string value)
|
||||
#cert_file=<None>
|
||||
|
||||
# Location of the SSL Key File to use for enabling SSL mode
|
||||
# (string value)
|
||||
#key_file=<None>
|
||||
|
||||
# Number of workers for Heat service (integer value)
|
||||
#workers=0
|
||||
|
||||
|
||||
#
|
||||
# Options defined in heat.db.api
|
||||
#
|
||||
@ -508,20 +481,91 @@
|
||||
#auth_uri=<None>
|
||||
|
||||
|
||||
[matchmaker_redis]
|
||||
[heat_api_cloudwatch]
|
||||
|
||||
#
|
||||
# Options defined in heat.openstack.common.rpc.matchmaker_redis
|
||||
# Options defined in heat.common.wsgi
|
||||
#
|
||||
|
||||
# Host to locate redis (string value)
|
||||
#host=127.0.0.1
|
||||
# Address to bind the server. Useful when selecting a
|
||||
# particular network interface. (string value)
|
||||
#bind_host=0.0.0.0
|
||||
|
||||
# Use this port to connect to redis host. (integer value)
|
||||
#port=6379
|
||||
# The port on which the server will listen. (integer value)
|
||||
#bind_port=8003
|
||||
|
||||
# Password for Redis server. (optional) (string value)
|
||||
#password=<None>
|
||||
# Number of backlog requests to configure the socket with
|
||||
# (integer value)
|
||||
#backlog=4096
|
||||
|
||||
# Location of the SSL Certificate File to use for SSL mode
|
||||
# (string value)
|
||||
#cert_file=<None>
|
||||
|
||||
# Location of the SSL Key File to use for enabling SSL mode
|
||||
# (string value)
|
||||
#key_file=<None>
|
||||
|
||||
# Number of workers for Heat service (integer value)
|
||||
#workers=0
|
||||
|
||||
|
||||
[heat_api]
|
||||
|
||||
#
|
||||
# Options defined in heat.common.wsgi
|
||||
#
|
||||
|
||||
# Address to bind the server. Useful when selecting a
|
||||
# particular network interface. (string value)
|
||||
#bind_host=0.0.0.0
|
||||
|
||||
# The port on which the server will listen. (integer value)
|
||||
#bind_port=8004
|
||||
|
||||
# Number of backlog requests to configure the socket with
|
||||
# (integer value)
|
||||
#backlog=4096
|
||||
|
||||
# Location of the SSL Certificate File to use for SSL mode
|
||||
# (string value)
|
||||
#cert_file=<None>
|
||||
|
||||
# Location of the SSL Key File to use for enabling SSL mode
|
||||
# (string value)
|
||||
#key_file=<None>
|
||||
|
||||
# Number of workers for Heat service (integer value)
|
||||
#workers=0
|
||||
|
||||
|
||||
[heat_api_cfn]
|
||||
|
||||
#
|
||||
# Options defined in heat.common.wsgi
|
||||
#
|
||||
|
||||
# Address to bind the server. Useful when selecting a
|
||||
# particular network interface. (string value)
|
||||
#bind_host=0.0.0.0
|
||||
|
||||
# The port on which the server will listen. (integer value)
|
||||
#bind_port=8000
|
||||
|
||||
# Number of backlog requests to configure the socket with
|
||||
# (integer value)
|
||||
#backlog=4096
|
||||
|
||||
# Location of the SSL Certificate File to use for SSL mode
|
||||
# (string value)
|
||||
#cert_file=<None>
|
||||
|
||||
# Location of the SSL Key File to use for enabling SSL mode
|
||||
# (string value)
|
||||
#key_file=<None>
|
||||
|
||||
# Number of workers for Heat service (integer value)
|
||||
#workers=0
|
||||
|
||||
|
||||
[auth_password]
|
||||
@ -549,3 +593,19 @@
|
||||
#ringfile=/etc/oslo/matchmaker_ring.json
|
||||
|
||||
|
||||
[matchmaker_redis]
|
||||
|
||||
#
|
||||
# Options defined in heat.openstack.common.rpc.matchmaker_redis
|
||||
#
|
||||
|
||||
# Host to locate redis (string value)
|
||||
#host=127.0.0.1
|
||||
|
||||
# Use this port to connect to redis host. (integer value)
|
||||
#port=6379
|
||||
|
||||
# Password for Redis server. (optional) (string value)
|
||||
#password=<None>
|
||||
|
||||
|
||||
|
@ -50,34 +50,92 @@ from heat.openstack.common import importutils
|
||||
|
||||
URL_LENGTH_LIMIT = 50000
|
||||
|
||||
bind_opts = [
|
||||
api_opts = [
|
||||
cfg.StrOpt('bind_host', default='0.0.0.0',
|
||||
help=_('Address to bind the server. Useful when '
|
||||
'selecting a particular network interface.')),
|
||||
cfg.IntOpt('bind_port',
|
||||
help=_('The port on which the server will listen.'))
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(bind_opts)
|
||||
|
||||
socket_opts = [
|
||||
'selecting a particular network interface.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('bind_port', default=8004,
|
||||
help=_('The port on which the server will listen.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('backlog', default=4096,
|
||||
help=_("Number of backlog requests "
|
||||
"to configure the socket with")),
|
||||
"to configure the socket with"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.StrOpt('cert_file', default=None,
|
||||
help=_("Location of the SSL Certificate File "
|
||||
"to use for SSL mode")),
|
||||
"to use for SSL mode"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.StrOpt('key_file', default=None,
|
||||
help=_("Location of the SSL Key File to use "
|
||||
"for enabling SSL mode")),
|
||||
"for enabling SSL mode"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('workers', default=0,
|
||||
help=_("Number of workers for Heat service"),
|
||||
deprecated_group='DEFAULT'),
|
||||
]
|
||||
api_group = cfg.OptGroup('heat_api')
|
||||
cfg.CONF.register_group(api_group)
|
||||
cfg.CONF.register_opts(api_opts,
|
||||
group=api_group)
|
||||
|
||||
cfg.CONF.register_opts(socket_opts)
|
||||
api_cfn_opts = [
|
||||
cfg.StrOpt('bind_host', default='0.0.0.0',
|
||||
help=_('Address to bind the server. Useful when '
|
||||
'selecting a particular network interface.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('bind_port', default=8000,
|
||||
help=_('The port on which the server will listen.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('backlog', default=4096,
|
||||
help=_("Number of backlog requests "
|
||||
"to configure the socket with"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.StrOpt('cert_file', default=None,
|
||||
help=_("Location of the SSL Certificate File "
|
||||
"to use for SSL mode"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.StrOpt('key_file', default=None,
|
||||
help=_("Location of the SSL Key File to use "
|
||||
"for enabling SSL mode"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('workers', default=0,
|
||||
help=_("Number of workers for Heat service"),
|
||||
deprecated_group='DEFAULT'),
|
||||
]
|
||||
api_cfn_group = cfg.OptGroup('heat_api_cfn')
|
||||
cfg.CONF.register_group(api_cfn_group)
|
||||
cfg.CONF.register_opts(api_cfn_opts,
|
||||
group=api_cfn_group)
|
||||
|
||||
workers_opts = cfg.IntOpt('workers', default=0,
|
||||
help=_("Number of workers for Heat service"))
|
||||
|
||||
cfg.CONF.register_opt(workers_opts)
|
||||
api_cw_opts = [
|
||||
cfg.StrOpt('bind_host', default='0.0.0.0',
|
||||
help=_('Address to bind the server. Useful when '
|
||||
'selecting a particular network interface.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('bind_port', default=8003,
|
||||
help=_('The port on which the server will listen.'),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('backlog', default=4096,
|
||||
help=_("Number of backlog requests "
|
||||
"to configure the socket with"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.StrOpt('cert_file', default=None,
|
||||
help=_("Location of the SSL Certificate File "
|
||||
"to use for SSL mode"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.StrOpt('key_file', default=None,
|
||||
help=_("Location of the SSL Key File to use "
|
||||
"for enabling SSL mode"),
|
||||
deprecated_group='DEFAULT'),
|
||||
cfg.IntOpt('workers', default=0,
|
||||
help=_("Number of workers for Heat service"),
|
||||
deprecated_group='DEFAULT'),
|
||||
]
|
||||
api_cw_group = cfg.OptGroup('heat_api_cloudwatch')
|
||||
cfg.CONF.register_group(api_cw_group)
|
||||
cfg.CONF.register_opts(api_cw_opts,
|
||||
group=api_cw_group)
|
||||
|
||||
|
||||
class WritableLogger(object):
|
||||
@ -93,9 +151,6 @@ class WritableLogger(object):
|
||||
|
||||
def get_bind_addr(conf, default_port=None):
|
||||
"""Return the host and port to bind to."""
|
||||
for opt in bind_opts:
|
||||
if opt.name not in conf:
|
||||
conf.register_opt(opt)
|
||||
return (conf.bind_host, conf.bind_port or default_port)
|
||||
|
||||
|
||||
@ -120,8 +175,6 @@ def get_socket(conf, default_port):
|
||||
bind_addr[1], socket.AF_UNSPEC, socket.SOCK_STREAM)
|
||||
if addr[0] in (socket.AF_INET, socket.AF_INET6)][0]
|
||||
|
||||
conf.register_opts(socket_opts)
|
||||
|
||||
cert_file = conf.cert_file
|
||||
key_file = conf.key_file
|
||||
use_ssl = cert_file or key_file
|
||||
|
Loading…
Reference in New Issue
Block a user