Merge "Break reference cycle between ResourceRegistry and ResourceInfo"

This commit is contained in:
Jenkins 2016-04-21 04:42:50 +00:00 committed by Gerrit Code Review
commit c093d8016d
1 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import glob
import itertools
import os.path
import re
import weakref
from oslo_config import cfg
from oslo_log import log
@ -114,12 +115,16 @@ class ResourceInfo(object):
return MapResourceInfo(registry, path, value)
def __init__(self, registry, path, value):
self.registry = registry
self._registry = weakref.ref(registry)
self.path = path
self.name = path[-1]
self.value = value
self.user_resource = True
@property
def registry(self):
return self._registry()
def __eq__(self, other):
if other is None:
return False