Juan Hernandez has uploaded a new change for review. Change subject: cli: Allow any string as parent identifier ......................................................................
cli: Allow any string as parent identifier Currently the CLI assumes that the identifiers of parent enties are UUIDs, but this is not always the case. This patch changes the CLI so that when a parent identifier is given it will first try to find that exact identifier, avoiding the conversion to UUID. If the identifier isn't found then it will try to lookup the parent by name. Change-Id: I438e0d5e3c29302fda63e0f0ab01e87a6841e10e Bug-Url: https://bugzilla.redhat.com/1177367 Signed-off-by: Juan Hernandez <[email protected]> --- M src/ovirtcli/command/command.py 1 file changed, 2 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/35/36535/1 diff --git a/src/ovirtcli/command/command.py b/src/ovirtcli/command/command.py index 1ccedca..08f07c4 100644 --- a/src/ovirtcli/command/command.py +++ b/src/ovirtcli/command/command.py @@ -20,7 +20,6 @@ from ovirtsdk.xml import params from ovirtsdk.utils.parsehelper import ParseHelper -import uuid from ovirtcli.utils.methodhelper import MethodHelper from ovirtsdk.infrastructure import brokers from ovirtsdk.utils.ordereddict import OrderedDict @@ -66,10 +65,8 @@ if hasattr(coll_ins, 'get'): if not val: self.error(Messages.Error.INVALID_OPTION % key) - uuid_cand = self._toUUID(val) - if uuid_cand != None: - base = coll_ins.get(id=val) - else: + base = coll_ins.get(id=val) + if base is None: base = coll_ins.get(name=val) if not base: @@ -394,12 +391,6 @@ return coll.get(id=id, **kwargs) else: return coll.get(id=id) - - def _toUUID(self, string): - try: - return uuid.UUID(string) - except: - return None def get_singular_types(self, method, typ=None, expendNestedTypes=True, groupOptions=True): """Return a list of singular types.""" -- To view, visit http://gerrit.ovirt.org/36535 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I438e0d5e3c29302fda63e0f0ab01e87a6841e10e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
