Fix deprecation warning for threadgroup.add_timer

This resolves the following deprecation warning:

b'/home/zuul/src/git.openstack.org/openstack/nova/.tox/functional-py35/
lib/python3.5/site-packages/oslo_service/threadgroup.py:193:
DeprecationWarning: Calling add_timer() with arguments to the callback
function is deprecated. Use add_timer_args() instead.'

The add_timer_args method was added in 1.34.0:

  Ib2791342263e2b88c045bcc92adc8160f57a0ed6

So the required version of oslo.service is also updated.

Change-Id: Id54226dc926839686906d04ecf8d791c0881f82a
Partial-Bug: #1813147
This commit is contained in:
Matt Riedemann 2019-02-07 09:04:25 -05:00
parent fa454c8372
commit c03cc26ee0
6 changed files with 12 additions and 8 deletions

View File

@ -88,7 +88,7 @@ oslo.privsep==1.23.0
oslo.reports==1.18.0 oslo.reports==1.18.0
oslo.rootwrap==5.8.0 oslo.rootwrap==5.8.0
oslo.serialization==2.21.1 oslo.serialization==2.21.1
oslo.service==1.33.0 oslo.service==1.34.0
oslo.upgradecheck==0.1.1 oslo.upgradecheck==0.1.1
oslo.utils==3.37.0 oslo.utils==3.37.0
oslo.versionedobjects==1.33.3 oslo.versionedobjects==1.33.3

View File

@ -50,8 +50,9 @@ class DbDriver(base.Driver):
' ServiceGroup driver')) ' ServiceGroup driver'))
report_interval = service.report_interval report_interval = service.report_interval
if report_interval: if report_interval:
service.tg.add_timer(report_interval, self._report_state, service.tg.add_timer_args(
api.INITIAL_REPORTING_DELAY, service) report_interval, self._report_state, args=[service],
initial_delay=api.INITIAL_REPORTING_DELAY)
def is_up(self, service_ref): def is_up(self, service_ref):
"""Moved from nova.utils """Moved from nova.utils

View File

@ -54,8 +54,9 @@ class MemcachedDriver(base.Driver):
'Memcached based ServiceGroup driver')) 'Memcached based ServiceGroup driver'))
report_interval = service.report_interval report_interval = service.report_interval
if report_interval: if report_interval:
service.tg.add_timer(report_interval, self._report_state, service.tg.add_timer_args(
api.INITIAL_REPORTING_DELAY, service) report_interval, self._report_state, args=[service],
initial_delay=api.INITIAL_REPORTING_DELAY)
def is_up(self, service_ref): def is_up(self, service_ref):
"""Moved from nova.utils """Moved from nova.utils

View File

@ -76,7 +76,8 @@ class DBServiceGroupTestCase(test.NoDBTestCase):
self.servicegroup_api.join('fake-host', 'fake-topic', service) self.servicegroup_api.join('fake-host', 'fake-topic', service)
fn = self.servicegroup_api._driver._report_state fn = self.servicegroup_api._driver._report_state
service.tg.add_timer.assert_called_once_with(1, fn, 5, service) service.tg.add_timer_args.assert_called_once_with(
1, fn, args=[service], initial_delay=5)
@mock.patch.object(objects.Service, 'save') @mock.patch.object(objects.Service, 'save')
def test_report_state(self, upd_mock): def test_report_state(self, upd_mock):

View File

@ -52,7 +52,8 @@ class MemcachedServiceGroupTestCase(test.NoDBTestCase):
self.servicegroup_api.join('fake-host', 'fake-topic', service) self.servicegroup_api.join('fake-host', 'fake-topic', service)
fn = self.servicegroup_api._driver._report_state fn = self.servicegroup_api._driver._report_state
service.tg.add_timer.assert_called_once_with(1, fn, 5, service) service.tg.add_timer_args.assert_called_once_with(
1, fn, args=[service], initial_delay=5)
def test_report_state(self): def test_report_state(self):
service_ref = { service_ref = {

View File

@ -50,7 +50,7 @@ oslo.messaging>=6.3.0 # Apache-2.0
oslo.policy>=1.35.0 # Apache-2.0 oslo.policy>=1.35.0 # Apache-2.0
oslo.privsep>=1.23.0 # Apache-2.0 oslo.privsep>=1.23.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0
oslo.service>=1.33.0 # Apache-2.0 oslo.service>=1.34.0 # Apache-2.0
rfc3986>=1.1.0 # Apache-2.0 rfc3986>=1.1.0 # Apache-2.0
oslo.middleware>=3.31.0 # Apache-2.0 oslo.middleware>=3.31.0 # Apache-2.0
psutil>=3.2.2 # BSD psutil>=3.2.2 # BSD