Michael Pasternak has posted comments on this change. Change subject: cli: construct object using factory on update, rather than fetching live instance ......................................................................
Patch Set 6: (1 comment) .................................................... File src/ovirtcli/command/update.py Line 162: if hasattr(param_obj, 'id'): Line 163: setattr(param_obj, 'id', getattr(resource, 'id')) Line 164: resource_class = getattr(brokers, resource.__class__.__name__) Line 165: resource_instance = resource_class(param_obj, resource.context) Line 166: resource_instance = self.update_object_data(resource_instance, opts) ok, got it now, it is happens cause you're trying to invoke update() on the real object and not on the broker to this object, so AFAICS there is no escape from doing GET after all (i would not want creating broker manually + injecting all internals like context etc.), so lets do it like this: 1. do GET as it was before: resource = self.get_object() 2. check the instance of resource.superclass 3. create new instance of #2 4. inject #3 to the broker (resource) from #1 5. do self.update_object_data(resource, opts) where resource has clean superclass Line 167: result = self.execute_method(resource_instance, 'update', opts) Line 168: Line 169: else: Line 170: self.error( -- To view, visit http://gerrit.ovirt.org/14557 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I34a910a7f1ecae5385e2a6dcd2297a65f419bc9c Gerrit-PatchSet: 6 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Ravi Nori <[email protected]> Gerrit-Reviewer: Michael Pasternak <[email protected]> Gerrit-Reviewer: Ravi Nori <[email protected]> Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
