Hello community,
here is the log from the commit of package python-oslo.service for
openSUSE:Factory checked in at 2015-10-30 13:43:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-oslo.service (Old)
and /work/SRC/openSUSE:Factory/.python-oslo.service.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-oslo.service"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-oslo.service/python-oslo.service.changes
2015-09-09 20:20:55.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.python-oslo.service.new/python-oslo.service.changes
2015-10-30 13:44:00.000000000 +0100
@@ -1,0 +2,23 @@
+Mon Oct 19 07:21:49 UTC 2015 - [email protected]
+
+- update to 0.10.0:
+ * RetryDecorator should not log warnings/errors for expected exceptions
+ * Termination children on SIGHUP added
+ * Fix coverage configuration and execution
+ * Add register_opts function to sslutils
+ * Move the common thread manipulating routine to a shared routine
+ * Update log string to correctly denote what it waits on
+ * Cleanup thread on thread done callback
+ * Move 'history' -> release notes section
+ * Add unit tests for sslutils
+ * Expand README and clean up intro to sphinx docs
+ * Add shields.io version/downloads links/badges into README.rst
+ * add auto-generated docs for config options
+ * Change ignore-errors to ignore_errors
+ * Fix the home-page value in setup.cfg
+ * WSGI module was corrected
+ * Updated from global requirements
+ * ThreadGroup's stop didn't recognise the current thread correctly
+ * doing monkey_patch for unittest
+
+-------------------------------------------------------------------
Old:
----
oslo.service-0.9.0.tar.gz
New:
----
oslo.service-0.10.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-oslo.service.spec ++++++
--- /var/tmp/diff_new_pack.8jrTCZ/_old 2015-10-30 13:44:00.000000000 +0100
+++ /var/tmp/diff_new_pack.8jrTCZ/_new 2015-10-30 13:44:00.000000000 +0100
@@ -17,7 +17,7 @@
Name: python-oslo.service
-Version: 0.9.0
+Version: 0.10.0
Release: 0
Summary: Oslo service library
License: Apache-2.0
++++++ oslo.service-0.9.0.tar.gz -> oslo.service-0.10.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/.coveragerc
new/oslo.service-0.10.0/.coveragerc
--- old/oslo.service-0.9.0/.coveragerc 2015-09-01 20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/.coveragerc 2015-10-12 17:37:58.000000000 +0200
@@ -1,7 +1,8 @@
[run]
branch = True
-source = service
-omit = service/tests/*,service/openstack/*
+source = oslo_service
+omit = oslo_service/tests/*,oslo_service/openstack/*
[report]
-ignore-errors = True
+ignore_errors = True
+precision = 2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/AUTHORS
new/oslo.service-0.10.0/AUTHORS
--- old/oslo.service-0.9.0/AUTHORS 2015-09-01 20:39:42.000000000 +0200
+++ new/oslo.service-0.10.0/AUTHORS 2015-10-12 17:38:47.000000000 +0200
@@ -64,6 +64,7 @@
Qin Zhao <[email protected]>
Raymond Pekowski <[email protected]>
Rohit Jaiswal <[email protected]>
+Ronald Bradford <[email protected]>
Russell Bryant <[email protected]>
Sean Dague <[email protected]>
Sean McGinnis <[email protected]>
@@ -80,9 +81,11 @@
Victor Sergeyev <[email protected]>
Victor Stinner <[email protected]>
Zhongyue Luo <[email protected]>
+apporc <[email protected]>
fujioka yuuichi <[email protected]>
gongysh <[email protected]>
liu-sheng <[email protected]>
liyingjun <[email protected]>
ravikumar-venkatesan <[email protected]>
stanzgy <[email protected]>
+venkatamahesh <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/ChangeLog
new/oslo.service-0.10.0/ChangeLog
--- old/oslo.service-0.9.0/ChangeLog 2015-09-01 20:39:41.000000000 +0200
+++ new/oslo.service-0.10.0/ChangeLog 2015-10-12 17:38:47.000000000 +0200
@@ -1,6 +1,28 @@
CHANGES
=======
+0.10.0
+------
+
+* RetryDecorator should not log warnings/errors for expected exceptions
+* Termination children on SIGHUP added
+* Fix coverage configuration and execution
+* Add register_opts function to sslutils
+* Move the common thread manipulating routine to a shared routine
+* Update log string to correctly denote what it waits on
+* Cleanup thread on thread done callback
+* Move 'history' -> release notes section
+* Add unit tests for sslutils
+* Expand README and clean up intro to sphinx docs
+* Add shields.io version/downloads links/badges into README.rst
+* add auto-generated docs for config options
+* Change ignore-errors to ignore_errors
+* Fix the home-page value in setup.cfg
+* WSGI module was corrected
+* Updated from global requirements
+* ThreadGroup's stop didn't recognise the current thread correctly
+* doing monkey_patch for unittest
+
0.9.0
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/PKG-INFO
new/oslo.service-0.10.0/PKG-INFO
--- old/oslo.service-0.9.0/PKG-INFO 2015-09-01 20:39:42.000000000 +0200
+++ new/oslo.service-0.10.0/PKG-INFO 2015-10-12 17:38:47.000000000 +0200
@@ -1,16 +1,28 @@
Metadata-Version: 1.1
Name: oslo.service
-Version: 0.9.0
+Version: 0.10.0
Summary: oslo.service library
-Home-page: http://launchpad.net/oslo
+Home-page: http://wiki.openstack.org/wiki/Oslo#oslo.service
Author: OpenStack
Author-email: [email protected]
License: UNKNOWN
-Description: ===================================
- oslo.service
- ===================================
+Description: ========================================================
+ oslo.service -- Library for running OpenStack services
+ ========================================================
- Library for running OpenStack services
+ .. image:: https://img.shields.io/pypi/v/oslo.service.svg
+ :target: https://pypi.python.org/pypi/oslo.service/
+ :alt: Latest Version
+
+ .. image:: https://img.shields.io/pypi/dm/oslo.service.svg
+ :target: https://pypi.python.org/pypi/oslo.service/
+ :alt: Downloads
+
+ oslo.service provides a framework for defining new long-running
+ services using the patterns established by other OpenStack
+ applications. It also includes utilities long-running applications
+ might need for working with SSL or WSGI, performing periodic
+ operations, interacting with systemd, etc.
* Free software: Apache license
* Documentation: http://docs.openstack.org/developer/oslo.service
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/README.rst
new/oslo.service-0.10.0/README.rst
--- old/oslo.service-0.9.0/README.rst 2015-09-01 20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/README.rst 2015-10-12 17:37:58.000000000 +0200
@@ -1,8 +1,20 @@
-===================================
-oslo.service
-===================================
+========================================================
+ oslo.service -- Library for running OpenStack services
+========================================================
-Library for running OpenStack services
+.. image:: https://img.shields.io/pypi/v/oslo.service.svg
+ :target: https://pypi.python.org/pypi/oslo.service/
+ :alt: Latest Version
+
+.. image:: https://img.shields.io/pypi/dm/oslo.service.svg
+ :target: https://pypi.python.org/pypi/oslo.service/
+ :alt: Downloads
+
+oslo.service provides a framework for defining new long-running
+services using the patterns established by other OpenStack
+applications. It also includes utilities long-running applications
+might need for working with SSL or WSGI, performing periodic
+operations, interacting with systemd, etc.
* Free software: Apache license
* Documentation: http://docs.openstack.org/developer/oslo.service
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/doc/source/conf.py
new/oslo.service-0.10.0/doc/source/conf.py
--- old/oslo.service-0.9.0/doc/source/conf.py 2015-09-01 20:39:05.000000000
+0200
+++ new/oslo.service-0.10.0/doc/source/conf.py 2015-10-12 17:37:58.000000000
+0200
@@ -22,8 +22,8 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
- #'sphinx.ext.intersphinx',
- 'oslosphinx'
+ 'oslosphinx',
+ 'oslo_config.sphinxext',
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/doc/source/index.rst
new/oslo.service-0.10.0/doc/source/index.rst
--- old/oslo.service-0.9.0/doc/source/index.rst 2015-09-01 20:39:05.000000000
+0200
+++ new/oslo.service-0.10.0/doc/source/index.rst 2015-10-12
17:37:58.000000000 +0200
@@ -1,16 +1,20 @@
-========================================
-Welcome to oslo.service's documentation!
-========================================
-
-Library for running OpenStack services
+========================================================
+ oslo.service -- Library for running OpenStack services
+========================================================
+
+oslo.service provides a framework for defining new long-running
+services using the patterns established by other OpenStack
+applications. It also includes utilities long-running applications
+might need for working with SSL or WSGI, performing periodic
+operations, interacting with systemd, etc.
.. toctree::
:maxdepth: 2
installation
usage
+ opts
contributing
- history
API Documentation
=================
@@ -26,6 +30,14 @@
api/systemd
api/threadgroup
+Release Notes
+=============
+
+.. toctree::
+ :maxdepth: 1
+
+ history
+
Indices and tables
==================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/doc/source/opts.rst
new/oslo.service-0.10.0/doc/source/opts.rst
--- old/oslo.service-0.9.0/doc/source/opts.rst 1970-01-01 01:00:00.000000000
+0100
+++ new/oslo.service-0.10.0/doc/source/opts.rst 2015-10-12 17:37:58.000000000
+0200
@@ -0,0 +1,36 @@
+=======================
+ Configuration Options
+=======================
+
+oslo.service uses oslo.config to define and manage configuration options
+to allow the deployer to control how an application uses this library.
+
+periodic_task
+=============
+
+These options apply to services using the periodic task features of
+oslo.service.
+
+.. show-options:: oslo.service.periodic_task
+
+service
+=======
+
+These options apply to services using the basic service framework.
+
+.. show-options:: oslo.service.service
+
+sslutils
+========
+
+These options apply to services using the SSL utilities module.
+
+.. show-options:: oslo.service.sslutils
+
+wsgi
+====
+
+These options apply to services using the WSGI (Web Service Gateway
+Interface) module.
+
+.. show-options:: oslo.service.wsgi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo.service.egg-info/PKG-INFO
new/oslo.service-0.10.0/oslo.service.egg-info/PKG-INFO
--- old/oslo.service-0.9.0/oslo.service.egg-info/PKG-INFO 2015-09-01
20:39:42.000000000 +0200
+++ new/oslo.service-0.10.0/oslo.service.egg-info/PKG-INFO 2015-10-12
17:38:47.000000000 +0200
@@ -1,16 +1,28 @@
Metadata-Version: 1.1
Name: oslo.service
-Version: 0.9.0
+Version: 0.10.0
Summary: oslo.service library
-Home-page: http://launchpad.net/oslo
+Home-page: http://wiki.openstack.org/wiki/Oslo#oslo.service
Author: OpenStack
Author-email: [email protected]
License: UNKNOWN
-Description: ===================================
- oslo.service
- ===================================
+Description: ========================================================
+ oslo.service -- Library for running OpenStack services
+ ========================================================
- Library for running OpenStack services
+ .. image:: https://img.shields.io/pypi/v/oslo.service.svg
+ :target: https://pypi.python.org/pypi/oslo.service/
+ :alt: Latest Version
+
+ .. image:: https://img.shields.io/pypi/dm/oslo.service.svg
+ :target: https://pypi.python.org/pypi/oslo.service/
+ :alt: Downloads
+
+ oslo.service provides a framework for defining new long-running
+ services using the patterns established by other OpenStack
+ applications. It also includes utilities long-running applications
+ might need for working with SSL or WSGI, performing periodic
+ operations, interacting with systemd, etc.
* Free software: Apache license
* Documentation: http://docs.openstack.org/developer/oslo.service
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo.service.egg-info/SOURCES.txt
new/oslo.service-0.10.0/oslo.service.egg-info/SOURCES.txt
--- old/oslo.service-0.9.0/oslo.service.egg-info/SOURCES.txt 2015-09-01
20:39:42.000000000 +0200
+++ new/oslo.service-0.10.0/oslo.service.egg-info/SOURCES.txt 2015-10-12
17:38:47.000000000 +0200
@@ -20,6 +20,7 @@
doc/source/history.rst
doc/source/index.rst
doc/source/installation.rst
+doc/source/opts.rst
doc/source/usage.rst
doc/source/api/eventlet_backdoor.rst
doc/source/api/loopingcall.rst
@@ -59,6 +60,7 @@
oslo_service/tests/test_loopingcall.py
oslo_service/tests/test_periodic.py
oslo_service/tests/test_service.py
+oslo_service/tests/test_sslutils.py
oslo_service/tests/test_systemd.py
oslo_service/tests/test_threadgroup.py
oslo_service/tests/test_wsgi.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo.service.egg-info/pbr.json
new/oslo.service-0.10.0/oslo.service.egg-info/pbr.json
--- old/oslo.service-0.9.0/oslo.service.egg-info/pbr.json 2015-09-01
20:39:42.000000000 +0200
+++ new/oslo.service-0.10.0/oslo.service.egg-info/pbr.json 2015-10-12
17:38:47.000000000 +0200
@@ -1 +1 @@
-{"is_release": true, "git_version": "fad5b04"}
\ No newline at end of file
+{"git_version": "7ecf3be", "is_release": true}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/_options.py
new/oslo.service-0.10.0/oslo_service/_options.py
--- old/oslo.service-0.9.0/oslo_service/_options.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/_options.py 2015-10-12
17:37:58.000000000 +0200
@@ -80,11 +80,17 @@
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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/loopingcall.py
new/oslo.service-0.10.0/oslo_service/loopingcall.py
--- old/oslo.service-0.9.0/oslo_service/loopingcall.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/loopingcall.py 2015-10-12
17:37:58.000000000 +0200
@@ -247,18 +247,17 @@
result = f(*args, **kwargs)
except self._exceptions:
with excutils.save_and_reraise_exception() as ctxt:
- LOG.warn(_LW("Exception which is in the suggested list of "
- "exceptions occurred while invoking function:"
- " %s."),
- func_name,
- exc_info=True)
+ LOG.debug("Exception which is in the suggested list of "
+ "exceptions occurred while invoking function:"
+ " %s.",
+ func_name)
if (self._max_retry_count != -1 and
self._retry_count >= self._max_retry_count):
- LOG.error(_LE("Cannot retry %(func_name)s upon "
- "suggested exception "
- "since retry count (%(retry_count)d) "
- "reached max retry count "
- "(%(max_retry_count)d)."),
+ LOG.debug("Cannot retry %(func_name)s upon "
+ "suggested exception "
+ "since retry count (%(retry_count)d) "
+ "reached max retry count "
+ "(%(max_retry_count)d).",
{'retry_count': self._retry_count,
'max_retry_count': self._max_retry_count,
'func_name': func_name})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/service.py
new/oslo.service-0.10.0/oslo_service/service.py
--- old/oslo.service-0.9.0/oslo_service/service.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/service.py 2015-10-12
17:37:58.000000000 +0200
@@ -524,7 +524,7 @@
service.reset()
for pid in self.children:
- os.kill(pid, signal.SIGHUP)
+ os.kill(pid, signal.SIGTERM)
self.running = True
self.sigcaught = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/sslutils.py
new/oslo.service-0.10.0/oslo_service/sslutils.py
--- old/oslo.service-0.9.0/oslo_service/sslutils.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/sslutils.py 2015-10-12
17:37:58.000000000 +0200
@@ -28,6 +28,11 @@
return [(config_section, copy.deepcopy(_options.ssl_opts))]
+def register_opts(conf):
+ """Registers sslutils config options."""
+ return conf.register_opts(_options.ssl_opts, config_section)
+
+
def is_enabled(conf):
conf.register_opts(_options.ssl_opts, config_section)
cert_file = conf.ssl.cert_file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/tests/__init__.py
new/oslo.service-0.10.0/oslo_service/tests/__init__.py
--- old/oslo.service-0.9.0/oslo_service/tests/__init__.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/tests/__init__.py 2015-10-12
17:37:58.000000000 +0200
@@ -0,0 +1,27 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import os
+
+import eventlet
+
+if os.name == 'nt':
+ # eventlet monkey patching the os and thread modules causes
+ # subprocess.Popen to fail on Windows when using pipes due
+ # to missing non-blocking IO support.
+ #
+ # bug report on eventlet:
+ # https://bitbucket.org/eventlet/eventlet/issue/132/
+ # eventletmonkey_patch-breaks
+ eventlet.monkey_patch(os=False, thread=False)
+else:
+ eventlet.monkey_patch()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/tests/base.py
new/oslo.service-0.10.0/oslo_service/tests/base.py
--- old/oslo.service-0.9.0/oslo_service/tests/base.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/tests/base.py 2015-10-12
17:37:58.000000000 +0200
@@ -16,6 +16,7 @@
from oslotest import base as test_base
from oslo_service import _options
+from oslo_service import sslutils
class ServiceBaseTestCase(test_base.BaseTestCase):
@@ -25,7 +26,8 @@
self.conf_fixture = self.useFixture(config.Config())
self.conf_fixture.register_opts(_options.eventlet_backdoor_opts)
self.conf_fixture.register_opts(_options.service_opts)
- self.conf_fixture.register_opts(_options.ssl_opts)
+ self.conf_fixture.register_opts(_options.ssl_opts,
+ sslutils.config_section)
self.conf_fixture.register_opts(_options.periodic_opts)
self.conf = self.conf_fixture.conf
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/oslo.service-0.9.0/oslo_service/tests/test_service.py
new/oslo.service-0.10.0/oslo_service/tests/test_service.py
--- old/oslo.service-0.9.0/oslo_service/tests/test_service.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/tests/test_service.py 2015-10-12
17:37:58.000000000 +0200
@@ -27,13 +27,13 @@
import os
import signal
import socket
-import subprocess
import sys
import time
import traceback
import eventlet
from eventlet import event
+from eventlet.green import subprocess
import mock
from oslotest import base as test_base
from six.moves import queue
@@ -215,15 +215,16 @@
start_workers = self._spawn()
os.kill(self.pid, signal.SIGHUP)
+
+ def cond():
+ workers = self._get_workers()
+ return (len(workers) == len(start_workers) and
+ not set(start_workers).intersection(workers))
+
# Wait at most 5 seconds to respawn a worker
- cond = lambda: start_workers == self._get_workers()
- timeout = 5
+ timeout = 10
self._wait(cond, timeout)
-
- # Make sure worker pids match
- end_workers = self._get_workers()
- LOG.info('workers: %r' % end_workers)
- self.assertEqual(start_workers, end_workers)
+ self.assertTrue(cond())
class ServiceRestartTest(ServiceTestBase):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/oslo.service-0.9.0/oslo_service/tests/test_sslutils.py
new/oslo.service-0.10.0/oslo_service/tests/test_sslutils.py
--- old/oslo.service-0.9.0/oslo_service/tests/test_sslutils.py 1970-01-01
01:00:00.000000000 +0100
+++ new/oslo.service-0.10.0/oslo_service/tests/test_sslutils.py 2015-10-12
17:37:58.000000000 +0200
@@ -0,0 +1,109 @@
+# Copyright 2015 Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import mock
+import os
+import ssl
+
+from oslo_config import cfg
+
+from oslo_service import sslutils
+from oslo_service.tests import base
+
+
+CONF = cfg.CONF
+
+SSL_CERT_DIR = os.path.normpath(os.path.join(
+ os.path.dirname(os.path.abspath(__file__)),
+ 'ssl_cert'))
+
+
+class SslutilsTestCase(base.ServiceBaseTestCase):
+ """Test cases for sslutils."""
+
+ def setUp(self):
+ super(SslutilsTestCase, self).setUp()
+ self.cert_file_name = os.path.join(SSL_CERT_DIR, 'certificate.crt')
+ self.key_file_name = os.path.join(SSL_CERT_DIR, 'privatekey.key')
+ self.ca_file_name = os.path.join(SSL_CERT_DIR, 'ca.crt')
+
+ @mock.patch("exceptions.RuntimeError")
+ @mock.patch("os.path.exists")
+ def test_is_enabled(self, exists_mock, runtime_error_mock):
+ exists_mock.return_value = True
+ self.conf.set_default("cert_file", self.cert_file_name,
+ group=sslutils.config_section)
+ self.conf.set_default("key_file", self.key_file_name,
+ group=sslutils.config_section)
+ self.conf.set_default("ca_file", self.ca_file_name,
+ group=sslutils.config_section)
+ sslutils.is_enabled(self.conf)
+ self.assertFalse(runtime_error_mock.called)
+
+ @mock.patch("os.path.exists")
+ def test_is_enabled_no_ssl_cert_file_fails(self, exists_mock):
+ exists_mock.side_effect = [False]
+ self.conf.set_default("cert_file", "/no/such/file",
+ group=sslutils.config_section)
+ self.assertRaises(RuntimeError, sslutils.is_enabled, self.conf)
+
+ @mock.patch("os.path.exists")
+ def test_is_enabled_no_ssl_key_file_fails(self, exists_mock):
+ exists_mock.side_effect = [True, False]
+ self.conf.set_default("cert_file", self.cert_file_name,
+ group=sslutils.config_section)
+ self.conf.set_default("key_file", "/no/such/file",
+ group=sslutils.config_section)
+ self.assertRaises(RuntimeError, sslutils.is_enabled, self.conf)
+
+ @mock.patch("os.path.exists")
+ def test_is_enabled_no_ssl_ca_file_fails(self, exists_mock):
+ exists_mock.side_effect = [True, True, False]
+ self.conf.set_default("cert_file", self.cert_file_name,
+ group=sslutils.config_section)
+ self.conf.set_default("key_file", self.key_file_name,
+ group=sslutils.config_section)
+ self.conf.set_default("ca_file", "/no/such/file",
+ group=sslutils.config_section)
+ self.assertRaises(RuntimeError, sslutils.is_enabled, self.conf)
+
+ @mock.patch("ssl.wrap_socket")
+ @mock.patch("os.path.exists")
+ def _test_wrap(self, exists_mock, wrap_socket_mock, **kwargs):
+ exists_mock.return_value = True
+ sock = mock.Mock()
+ self.conf.set_default("cert_file", self.cert_file_name,
+ group=sslutils.config_section)
+ self.conf.set_default("key_file", self.key_file_name,
+ group=sslutils.config_section)
+ ssl_kwargs = {'server_side': True,
+ 'certfile': self.conf.ssl.cert_file,
+ 'keyfile': self.conf.ssl.key_file,
+ 'cert_reqs': ssl.CERT_NONE,
+ }
+ if kwargs:
+ ssl_kwargs.update(**kwargs)
+ sslutils.wrap(self.conf, sock)
+ wrap_socket_mock.assert_called_once_with(sock, **ssl_kwargs)
+
+ def test_wrap(self):
+ self._test_wrap()
+
+ def test_wrap_ca_file(self):
+ self.conf.set_default("ca_file", self.ca_file_name,
+ group=sslutils.config_section)
+ ssl_kwargs = {'ca_certs': self.conf.ssl.ca_file,
+ 'cert_reqs': ssl.CERT_REQUIRED
+ }
+ self._test_wrap(**ssl_kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/oslo.service-0.9.0/oslo_service/tests/test_threadgroup.py
new/oslo.service-0.10.0/oslo_service/tests/test_threadgroup.py
--- old/oslo.service-0.9.0/oslo_service/tests/test_threadgroup.py
2015-09-01 20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/tests/test_threadgroup.py
2015-10-12 17:37:58.000000000 +0200
@@ -19,6 +19,8 @@
import time
+from eventlet import event
+
from oslotest import base as test_base
from oslo_service import threadgroup
@@ -47,12 +49,32 @@
self.assertEqual(('arg',), timer.args)
self.assertEqual({'kwarg': 'kwarg'}, timer.kw)
+ def test_stop_current_thread(self):
+
+ stop_event = event.Event()
+ quit_event = event.Event()
+
+ def stop_self(*args, **kwargs):
+ if args[0] == 1:
+ time.sleep(1)
+ self.tg.stop()
+ stop_event.send('stop_event')
+ quit_event.wait()
+
+ for i in range(0, 4):
+ self.tg.add_thread(stop_self, i, kwargs='kwargs')
+
+ stop_event.wait()
+ self.assertEqual(1, len(self.tg.threads))
+ quit_event.send('quit_event')
+
def test_stop_immediately(self):
def foo(*args, **kwargs):
time.sleep(1)
start_time = time.time()
self.tg.add_thread(foo, 'arg', kwarg='kwarg')
+ time.sleep(0)
self.tg.stop()
end_time = time.time()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/threadgroup.py
new/oslo.service-0.10.0/oslo_service/threadgroup.py
--- old/oslo.service-0.9.0/oslo_service/threadgroup.py 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/oslo_service/threadgroup.py 2015-10-12
17:37:58.000000000 +0200
@@ -24,13 +24,13 @@
LOG = logging.getLogger(__name__)
-def _thread_done(gt, *args, **kwargs):
+def _on_thread_done(_greenthread, group, thread):
"""Callback function to be passed to GreenThread.link() when we spawn().
- Calls the :class:`ThreadGroup` to notify if.
-
+ Calls the :class:`ThreadGroup` to notify it to remove this thread from
+ the associated group.
"""
- kwargs['group'].thread_done(kwargs['thread'])
+ group.thread_done(thread)
class Thread(object):
@@ -42,7 +42,12 @@
"""
def __init__(self, thread, group):
self.thread = thread
- self.thread.link(_thread_done, group=group, thread=self)
+ self.thread.link(_on_thread_done, group, self)
+ self._ident = id(thread)
+
+ @property
+ def ident(self):
+ return self._ident
def stop(self):
self.thread.kill()
@@ -94,21 +99,25 @@
def timer_done(self, timer):
self.timers.remove(timer)
- def _stop_threads(self):
+ def _perform_action_on_threads(self, action_func, on_error_func):
current = threading.current_thread()
-
# Iterate over a copy of self.threads so thread_done doesn't
# modify the list while we're iterating
for x in self.threads[:]:
- if x is current:
- # don't kill the current thread.
+ if x.ident == current.ident:
+ # Don't perform actions on the current thread.
continue
try:
- x.stop()
+ action_func(x)
except eventlet.greenlet.GreenletExit:
pass
except Exception:
- LOG.exception(_LE('Error stopping thread.'))
+ on_error_func(x)
+
+ def _stop_threads(self):
+ self._perform_action_on_threads(
+ lambda x: x.stop(),
+ lambda x: LOG.exception(_LE('Error stopping thread.')))
def stop_timers(self):
for x in self.timers:
@@ -142,17 +151,7 @@
except eventlet.greenlet.GreenletExit:
pass
except Exception:
- LOG.exception(_LE('Error waiting on ThreadGroup.'))
- current = threading.current_thread()
-
- # Iterate over a copy of self.threads so thread_done doesn't
- # modify the list while we're iterating
- for x in self.threads[:]:
- if x is current:
- continue
- try:
- x.wait()
- except eventlet.greenlet.GreenletExit:
- pass
- except Exception as ex:
- LOG.exception(ex)
+ LOG.exception(_LE('Error waiting on timer.'))
+ self._perform_action_on_threads(
+ lambda x: x.wait(),
+ lambda x: LOG.exception(_LE('Error waiting on thread.')))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/oslo_service/wsgi.py
new/oslo.service-0.10.0/oslo_service/wsgi.py
--- old/oslo.service-0.9.0/oslo_service/wsgi.py 2015-09-01 20:39:05.000000000
+0200
+++ new/oslo.service-0.10.0/oslo_service/wsgi.py 2015-10-12
17:37:58.000000000 +0200
@@ -33,6 +33,7 @@
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 @@
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 @@
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 @@
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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/setup.cfg
new/oslo.service-0.10.0/setup.cfg
--- old/oslo.service-0.9.0/setup.cfg 2015-09-01 20:39:42.000000000 +0200
+++ new/oslo.service-0.10.0/setup.cfg 2015-10-12 17:38:47.000000000 +0200
@@ -5,7 +5,7 @@
README.rst
author = OpenStack
author-email = [email protected]
-home-page = http://launchpad.net/oslo
+home-page = http://wiki.openstack.org/wiki/Oslo#oslo.service
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@@ -60,7 +60,7 @@
universal = true
[egg_info]
-tag_build =
-tag_svn_revision = 0
tag_date = 0
+tag_svn_revision = 0
+tag_build =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/setup.py
new/oslo.service-0.10.0/setup.py
--- old/oslo.service-0.9.0/setup.py 2015-09-01 20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/setup.py 2015-10-12 17:37:58.000000000 +0200
@@ -25,5 +25,5 @@
pass
setuptools.setup(
- setup_requires=['pbr>=1.3'],
+ setup_requires=['pbr>=1.8'],
pbr=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/test-requirements.txt
new/oslo.service-0.10.0/test-requirements.txt
--- old/oslo.service-0.9.0/test-requirements.txt 2015-09-01
20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/test-requirements.txt 2015-10-12
17:37:58.000000000 +0200
@@ -9,3 +9,5 @@
# These are needed for docs generation
oslosphinx>=2.5.0 # Apache-2.0
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
+
+coverage>=3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/oslo.service-0.9.0/tox.ini
new/oslo.service-0.10.0/tox.ini
--- old/oslo.service-0.9.0/tox.ini 2015-09-01 20:39:05.000000000 +0200
+++ new/oslo.service-0.10.0/tox.ini 2015-10-12 17:37:58.000000000 +0200
@@ -36,7 +36,7 @@
commands = python setup.py build_sphinx
[testenv:cover]
-commands = python setup.py testr --coverage --testr-args='{posargs}'
+commands = python setup.py test --coverage
--coverage-package-name=oslo_service --testr-args='{posargs}'
[flake8]
# E123, E125 skipped as they are invalid PEP-8.