Ravi Nori has posted comments on this change.
Change subject: cli: construct object using factory on update, rather than
fetching live instance
......................................................................
Patch Set 6:
(2 comments)
....................................................
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)
When I execute the below line I get an error
result = self.execute_method(param_obj, 'update', opts)
++++++++++++++++++ ERROR ++++++++++++++++++
no such action "update"
Line 167: result = self.execute_method(resource_instance, 'update',
opts)
Line 168:
Line 169: else:
Line 170: self.error(
Line 177: args = self.arguments
Line 178: params_xml_type = ParseHelper.getXmlType(args[0])
Line 179: param_obj = None
Line 180: if params_xml_type:
Line 181: param_obj = params_xml_type.factory()
def create_params_obj(self):
"""Create an instance of param object."""
args = self.arguments
opts = self.options
base = self.resolve_base(opts)
typ = args[0] + 's'
collection = None
typs = self.get_singular_types(method='update', typ=args[0])
if base:
collection = getattr(base, typ)
else:
connection = self.check_connection()
if hasattr(connection, typ):
collection = getattr(connection, typ)
params_xml_type =
ParseHelper.getXmlType(ParseHelper.getSingularXmlTypeInstance(collection.__class__.__name__))
param_obj = None
if params_xml_type:
param_obj = params_xml_type.factory()
return param_obj
Is this what you have in mind?
Line 182: return param_obj
Line 183:
Line 184: def show_help(self):
Line 185: """Show help for "update"."""
--
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