Github user mxmrlv commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/129#discussion_r115981300
--- Diff: aria/storage/instrumentation.py ---
@@ -177,22 +232,30 @@ def apply_tracked_changes(tracked_changes, model):
instance = None
for attribute_name, value in tracked_attributes.items():
if value.initial != value.current:
- if not instance:
- instance = mapi.get(instance_id)
+ instance = instance or mapi.get(instance_id)
setattr(instance, attribute_name, value.current)
if instance:
_validate_version_id(instance, mapi)
mapi.update(instance)
successfully_updated_changes[mapi_name][instance_id] =
[
v.dict for v in tracked_attributes.values()]
+
+ for mapi_name, new_instance in new_instances.items():
+ successfully_updated_changes[mapi_name] = dict()
+ mapi = getattr(model, mapi_name)
+ for new_instance_kwargs in sorted(new_instance.values()):
+ instance = mapi.model_cls(**new_instance_kwargs)
+ mapi.put(instance)
+ successfully_updated_changes[mapi_name][instance.id] =
new_instance_kwargs
except BaseException:
for key, value in successfully_updated_changes.items():
if not value:
del successfully_updated_changes[key]
- model.logger.error(
- 'Registering all the changes to the storage has failed. {0}'
- 'The successful updates were: {0} '
- '{1}'.format(os.linesep,
json.dumps(successfully_updated_changes, indent=4)))
+ # TODO: if the successful has _STUB, the logging fails because it
can't serialize the object
--- End diff --
uncomment
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---