Discussion:
[Libstoragemgmt-devel] [PATCH 3/3] cmdline.py: Don't require uri when listing plugins
Tony Asleson
2014-02-24 23:10:04 UTC
Permalink
This got broken when we changed around the argument
parsing.

Signed-off-by: Tony Asleson <***@redhat.com>
---
lsm/lsm/cmdline.py | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/lsm/lsm/cmdline.py b/lsm/lsm/cmdline.py
index 9815569..64d44a1 100644
--- a/lsm/lsm/cmdline.py
+++ b/lsm/lsm/cmdline.py
@@ -973,16 +973,6 @@ class CmdLine:
## Method that calls the appropriate method based on what the list type is
# @param args Argparse argument object
def list(self, args):
-
- # We need a valid plug-in to instantiate even if all we are trying
- # to do is list the plug-ins at the moment to keep that code
- # the same in all cases, even though it isn't technically
- # required for the client library (static method)
- # TODO: Make this not necessary.
- if (args.type == "PLUGINS"):
- self.uri = "sim://"
- self.password = None
-
if args.type == 'VOLUMES':
self.display_data(self.c.volumes())
elif args.type == 'POOLS':
@@ -1684,7 +1674,16 @@ class CmdLine:
self.uri = self.args.uri

if self.uri is None:
- raise ArgError("--uri missing or export LSMCLI_URI")
+ # We need a valid plug-in to instantiate even if all we are trying
+ # to do is list the plug-ins at the moment to keep that code
+ # the same in all cases, even though it isn't technically
+ # required for the client library (static method)
+ # TODO: Make this not necessary.
+ if (self.args.type == "PLUGINS"):
+ self.uri = "sim://"
+ self.password = None
+ else:
+ raise ArgError("--uri missing or export LSMCLI_URI")

# Lastly get the password if requested.
if self.args.prompt:
--
1.8.2.1
Tony Asleson
2014-02-24 23:10:03 UTC
Permalink
This is confusing as it implies that no data is a bad thing
when in reality it just means we had no results.

Signed-off-by: Tony Asleson <***@redhat.com>
---
lsm/lsm/cmdline.py | 1 -
1 file changed, 1 deletion(-)

diff --git a/lsm/lsm/cmdline.py b/lsm/lsm/cmdline.py
index 36d37bb..9815569 100644
--- a/lsm/lsm/cmdline.py
+++ b/lsm/lsm/cmdline.py
@@ -729,7 +729,6 @@ class CmdLine:
# @param objects Data, first row is header all other data.
def display_data(self, objects):
if len(objects) == 0:
- out("No data retrieved")
return

if hasattr(self.args, 'optional') and self.args.optional:
--
1.8.2.1
Loading...