diff --git a/oslo_service/_options.py b/oslo_service/_options.py index e835f887..eb0d5bd9 100644 --- a/oslo_service/_options.py +++ b/oslo_service/_options.py @@ -80,11 +80,17 @@ wsgi_opts = [ ssl_opts = [ cfg.StrOpt('ca_file', help="CA certificate file to use to verify " - "connecting clients."), + "connecting clients.", + deprecated_group='DEFAULT', + deprecated_name='ssl_ca_file'), cfg.StrOpt('cert_file', help="Certificate file to use when starting " - "the server securely."), + "the server securely.", + deprecated_group='DEFAULT', + deprecated_name='ssl_cert_file'), cfg.StrOpt('key_file', help="Private key file to use when starting " - "the server securely."), + "the server securely.", + deprecated_group='DEFAULT', + deprecated_name='ssl_key_file'), ] diff --git a/oslo_service/wsgi.py b/oslo_service/wsgi.py index 6feae863..1e1c4c9e 100644 --- a/oslo_service/wsgi.py +++ b/oslo_service/wsgi.py @@ -33,6 +33,7 @@ import webob.exc from oslo_log import log as logging from oslo_service import _options +from oslo_service import service from oslo_service import sslutils from oslo_service._i18n import _, _LE, _LI @@ -45,12 +46,17 @@ def list_opts(): return [(None, copy.deepcopy(_options.wsgi_opts))] +def register_opts(conf): + """Registers WSGI config options.""" + return conf.register_opts(_options.wsgi_opts) + + class InvalidInput(Exception): message = _("Invalid input received: " "Unexpected argument for periodic task creation: %(arg)s.") -class Server(object): +class Server(service.ServiceBase): """Server class to manage a WSGI server, serving a WSGI application.""" def __init__(self, conf, name, app, host='0.0.0.0', port=0, pool_size=None, @@ -58,15 +64,19 @@ class Server(object): use_ssl=False, max_url_len=None): """Initialize, but do not start, a WSGI server. + :param conf: Instance of ConfigOpts. :param name: Pretty name for logging. :param app: The WSGI application to serve. :param host: IP address to serve the application. :param port: Port number to server the application. :param pool_size: Maximum number of eventlets to spawn concurrently. + :param protocol: Protocol class. :param backlog: Maximum number of queued connections. + :param use_ssl: Wraps the socket in an SSL context if True. :param max_url_len: Maximum length of permitted URLs. :returns: None :raises: InvalidInput + :raises: EnvironmentError """ self.conf = conf @@ -86,10 +96,9 @@ class Server(object): self._use_ssl = use_ssl self._max_url_len = max_url_len self.client_socket_timeout = conf.client_socket_timeout or None - self.default_pool_size = conf.wsgi_default_pool_size if backlog < 1: - raise InvalidInput(reason='The backlog must be more than 0') + raise InvalidInput(reason=_('The backlog must be more than 0')) bind_addr = (host, port) # TODO(dims): eventlet's green dns/socket module does not actually