summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2016-05-13 11:30:22 -0400
committerZane Bitter <zbitter@redhat.com>2016-05-13 11:30:22 -0400
commitc64b2cd1f337b263f1a34a1b532d86165c295d29 (patch)
tree993cf0976abf02deba69e46185cfed8460fa500a /contrib
parent22206030fe163125a4b74f2a57c16daf8e1078b3 (diff)
downloadheat-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.py10
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()