Juan Hernandez has uploaded a new change for review. Change subject: cli: Try id, name and alias for show ......................................................................
cli: Try id, name and alias for show The fix for bug 1148941 (commit 4b654a2) introduced a regression in the way that the "show" command locates objects, so that objects can't be located by name. For example, the following command will fail to locate the a virtual machine, even if it exists: # show vm myvm This patch fixes that regression, so that when given an object identifier the CLI will try to locate it first by identifier, then by name and finally by alias (for disks). Change-Id: I8d197c042e83939470aea93405546a25bdf3f0c0 Related-To: https://bugzilla.redhat.com/1148941 Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com> --- M src/ovirtcli/command/command.py 1 file changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/18/36918/1 diff --git a/src/ovirtcli/command/command.py b/src/ovirtcli/command/command.py index 1ccedca..ff1bd52 100644 --- a/src/ovirtcli/command/command.py +++ b/src/ovirtcli/command/command.py @@ -347,11 +347,17 @@ if obj_id is not None: _, kwargs = self._get_query_params(opts) if 'id' in options: - return self.__get_by_id(coll, obj_id, kwargs) + obj = self.__get_by_id(coll, obj_id, kwargs) + if obj is not None: + return obj if 'name' in options: - return self.__get_by_name(coll, obj_id, kwargs) + obj = self.__get_by_name(coll, obj_id, kwargs) + if obj is not None: + return obj if 'alias' in options: - return self.__get_by_alias(coll, obj_id, kwargs) + obj = self.__get_by_alias(coll, obj_id, kwargs) + if obj is not None: + return obj return None if 'id' in options: -- To view, visit http://gerrit.ovirt.org/36918 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8d197c042e83939470aea93405546a25bdf3f0c0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches