diff options
author | Zane Bitter <zbitter@redhat.com> | 2016-05-13 11:30:22 -0400 |
---|---|---|
committer | Zane Bitter <zbitter@redhat.com> | 2016-05-13 11:30:22 -0400 |
commit | c64b2cd1f337b263f1a34a1b532d86165c295d29 (patch) | |
tree | 993cf0976abf02deba69e46185cfed8460fa500a /contrib | |
parent | 22206030fe163125a4b74f2a57c16daf8e1078b3 (diff) | |
download | heat-c64b2cd1f337b263f1a34a1b532d86165c295d29.tar.gz |
Break reference cycle in KeystoneClient plugins
Change-Id: Ie8ddd132c3ce02a01b77242ce86f219ce4f86249
Partial-Bug: #1570974
Related-Bug: #1508134
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/rackspace/heat_keystoneclient_v2/client.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/rackspace/heat_keystoneclient_v2/client.py b/contrib/rackspace/heat_keystoneclient_v2/client.py index 66bc8d431..64f028e5d 100644 --- a/contrib/rackspace/heat_keystoneclient_v2/client.py +++ b/contrib/rackspace/heat_keystoneclient_v2/client.py @@ -13,6 +13,8 @@ """Client Library for Keystone Resources.""" +import weakref + from keystoneclient.v2_0 import client as kc from oslo_config import cfg from oslo_log import log as logging @@ -48,7 +50,7 @@ class KeystoneClientV2(object): # get a new trust-token even if context.auth_token is set. # # - context.auth_url is expected to contain the v2.0 keystone endpoint - self.context = context + self._context = weakref.ref(context) self._client = None if self.context.trust_id: @@ -57,6 +59,12 @@ class KeystoneClientV2(object): self._client = self._v2_client_init() @property + def context(self): + ctxt = self._context() + assert ctxt is not None, "Need a reference to the context" + return ctxt + + @property def client(self): if not self._client: self._client = self._v2_client_init() |