Merge "Don't put non-initialized objects into ObjectStore"

This commit is contained in:
Jenkins 2016-08-16 16:46:51 +00:00 committed by Gerrit Code Review
commit 8140527e92
2 changed files with 13 additions and 5 deletions

View File

@ -25,6 +25,7 @@ from murano.dsl import yaql_integration
class MuranoObject(dsl_types.MuranoObject):
def __init__(self, murano_class, owner, object_id=None, name=None,
known_classes=None, this=None):
self.__initialized = False
if known_classes is None:
known_classes = {}
self.__owner = owner.real_this if owner else None
@ -138,11 +139,13 @@ class MuranoObject(dsl_types.MuranoObject):
yield t
def run_init():
context[constants.CTX_ARGUMENT_OWNER] = self.real_this
init.invoke(self.real_this, (), init_args,
context.create_child_context())
if init:
context[constants.CTX_ARGUMENT_OWNER] = self.real_this
init.invoke(self.real_this, (), init_args,
context.create_child_context())
self.__initialized = True
if (not object_store.initializing and init
if (not object_store.initializing
and not helpers.is_objects_dry_run_mode()):
yield run_init
@ -162,6 +165,10 @@ class MuranoObject(dsl_types.MuranoObject):
def real_this(self):
return self.__this or self
@property
def initialized(self):
return self.__initialized
def get_property(self, name, context=None):
start_type, derived = self.__type, False
caller_class = None if not context else helpers.get_type(context)

View File

@ -66,7 +66,8 @@ class ObjectStore(object):
default_type=default_type, context=context)
for obj_id in model_store.iterate():
obj = model_store.get(obj_id)
self.put(obj)
if obj.initialized:
self.put(obj)
return result
@staticmethod