In the service lock, reset the service, not the lock

It turns out that when you're in a context manager that has gotten the
lock, attempting to set that lock to None will fail. It's also not the
thing we actually want to do. What we WANT to do is reset the _service_
so that we'll ensure a new service object gets created.

Change-Id: Ic39ef0418dcd5c0cbbe710ac1c31e58b744f56b5
This commit is contained in:
Monty Taylor 2016-03-07 23:03:12 -05:00
parent cf43b98e33
commit 543954dd05
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- Fixed an issue where a section of code that was supposed to be resetting
the SwiftService object was instead resetting the protective mutex around
the SwiftService object leading to an exception of "__exit__"

View File

@ -2209,7 +2209,7 @@ class OpenStackCloud(object):
with self._swift_client_lock:
self._swift_client = None
with self._swift_service_lock:
self._swift_service_lock = None
self._swift_service = None
self.create_object(
container, name, filename,