Don't start task managers passed in to Connection

If someone (such as our friend nodepool) creates and passes in a
TaskManager, it should be assumed that the calling context controls the
lifecycle of that TaskManager. In that case, don't run start() on it.

Depends-On: https://review.openstack.org/612168
Change-Id: I0ac5dc428250158471cb64d5b1601cabbb4deb86
This commit is contained in:
Monty Taylor 2018-10-21 10:27:38 -05:00
parent ec90fb6402
commit 448cda91e3
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
2 changed files with 14 additions and 3 deletions

View File

@ -288,9 +288,14 @@ class Connection(six.with_metaclass(_meta.ConnectionMeta,
load_envvars=cloud is not None,
**kwargs)
self.task_manager = task_manager or _task_manager.TaskManager(
self.config.full_name)
self.task_manager.start()
if task_manager:
# If a TaskManager was passed in, don't start it, assume it's
# under the control of the calling context.
self.task_manager = task_manager
else:
self.task_manager = _task_manager.TaskManager(
self.config.full_name)
self.task_manager.start()
self._session = None
self._proxies = {}

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixed a regression in the new `TaskManager` code which caused programs that
were passing in a `TaskManager` that they had been running `start` on to
fail due to a double call.