Ravi Nori has uploaded a new change for review.

Change subject: cli: construct object using factory on update, rather than 
fetching live instance
......................................................................

cli: construct object using factory on update, rather than fetching live 
instance

Construct object using factory and set parameters to it
instead of fetching it from server and updating it.

Change-Id: I34a910a7f1ecae5385e2a6dcd2297a65f419bc9c
Bug-Url: https://bugzilla.redhat.com/950684
Signed-off-by: Ravi Nori <[email protected]>
---
M src/ovirtcli/command/update.py
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/80/20880/1

diff --git a/src/ovirtcli/command/update.py b/src/ovirtcli/command/update.py
index 8cea028..466a7cc 100644
--- a/src/ovirtcli/command/update.py
+++ b/src/ovirtcli/command/update.py
@@ -149,13 +149,21 @@
         if resource is None:
             self.error(Messages.Error.NO_SUCH_OBJECT % (args[0], args[1]))
         elif hasattr(resource, 'update'):
-            obj = self.update_object_data(resource, opts)
+            obj = 
self.update_object_data(self.__create_set_superclass(resource), opts)
             result = self.execute_method(obj, 'update', opts)
         else:
             self.error(Messages.Error.OBJECT_IS_IMMUTABLE % (args[0], args[1]))
 
         self.context.formatter.format(self.context, result)
 
+    def __create_set_superclass(self, resource):
+        """Create an instance of param object."""
+        param_obj = type(resource.superclass).factory()
+        if hasattr(param_obj, 'id'):
+            setattr(param_obj, 'id', getattr(resource, 'id'))
+        resource.superclass = param_obj
+        return resource
+
     def show_help(self):
         """Show help for "update"."""
 


-- 
To view, visit http://gerrit.ovirt.org/20880
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I34a910a7f1ecae5385e2a6dcd2297a65f419bc9c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: cli_3.3
Gerrit-Owner: Ravi Nori <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to