Michael Pasternak has uploaded a new change for review.

Change subject: cli: adapt to sdk restriction of .get() to id/name
......................................................................

cli: adapt to sdk restriction of .get() to id/name

latest sdk restricts .get() to id/name, **kwargs no
longer supported.

Change-Id: I6d26ed70154300793b8ea11af5b424148ca306b3
Signed-off-by: Michael Pasternak <mpast...@redhat.com>
---
M src/cli/messages.py
M src/ovirtcli/command/command.py
M src/ovirtcli/shell/showcmdshell.py
3 files changed, 7 insertions(+), 7 deletions(-)


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

diff --git a/src/cli/messages.py b/src/cli/messages.py
index 5a50f56..7ee371f 100644
--- a/src/cli/messages.py
+++ b/src/cli/messages.py
@@ -27,6 +27,7 @@
         NO_IDENTIFIER = '%s identifier required.'
         NO_QUERY_ARGS = '"--query" argument is not available for this type of 
listing.'
         NO_KWARGS = '"--kwargs" argument is not available for this type of %s.'
+        NO_ID = '"--id" argument is not available for this type of %s.'
         NO_NAME = '"--name" argument is not available for this type of show.'
         NO_CONSOLE_FOUND = '%s viewer was not found, please install %s first.'
         NOT_CONNECTED = OvirtCliSettings.PRODUCT.lower() + '-shell is not 
connected.'
diff --git a/src/ovirtcli/command/command.py b/src/ovirtcli/command/command.py
index 9060620..8ee11cb 100644
--- a/src/ovirtcli/command/command.py
+++ b/src/ovirtcli/command/command.py
@@ -303,18 +303,16 @@
 
         if name and 'name' not in options:
             self.error(Messages.Error.NO_NAME)
-        if kwargs and 'kwargs' not in options:
-            self.error(Messages.Error.NO_KWARGS % 'show')
+        if kwargs and kwargs.has_key('id') and 'id' not in options:
+            self.error(Messages.Error.NO_ID % 'show')
 
         if hasattr(base, candidate + 's'):
             coll = getattr(base, candidate + 's')
             if coll is not None:
-                if name and kwargs:
-                    return coll.get(name=name, **kwargs)
                 if name:
                     return coll.get(name=name)
-                if kwargs:
-                    return coll.get(**kwargs)
+                if kwargs and kwargs.has_key('id'):
+                    return coll.get(id=kwargs['id'])
                 else:
                     uuid_cand = self._toUUID(obj_id)
                     if uuid_cand != None:
diff --git a/src/ovirtcli/shell/showcmdshell.py 
b/src/ovirtcli/shell/showcmdshell.py
index f467cf8..777e497 100644
--- a/src/ovirtcli/shell/showcmdshell.py
+++ b/src/ovirtcli/shell/showcmdshell.py
@@ -23,7 +23,8 @@
 class ShowCmdShell(CmdShell):
     NAME = 'show'
     ALIAS = 'get'
-    OPTIONS = ['name', 'kwargs']
+    #TODO: retrieve options dynamically 
+    OPTIONS = ['name', 'id']
 
     def __init__(self, context, parser):
         CmdShell.__init__(self, context, parser)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d26ed70154300793b8ea11af5b424148ca306b3
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: master
Gerrit-Owner: Michael Pasternak <mpast...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to