cli: Fix nonetype issue with cachemaker and exit after printing version

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/4ad5d1a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/4ad5d1a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/4ad5d1a4

Branch: refs/heads/cisco-vnmc-api-integration
Commit: 4ad5d1a4f55a1eb1dc0ebf164f0fe081aeebb2d7
Parents: d7f9aa6
Author: Rohit Yadav <[email protected]>
Authored: Wed Mar 20 12:42:29 2013 +0530
Committer: Rohit Yadav <[email protected]>
Committed: Wed Mar 20 12:42:29 2013 +0530

----------------------------------------------------------------------
 tools/cli/cloudmonkey/cachemaker.py  |    6 +++++-
 tools/cli/cloudmonkey/cloudmonkey.py |    1 +
 2 files changed, 6 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad5d1a4/tools/cli/cloudmonkey/cachemaker.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cachemaker.py 
b/tools/cli/cloudmonkey/cachemaker.py
index 8ac123c..a625b01 100644
--- a/tools/cli/cloudmonkey/cachemaker.py
+++ b/tools/cli/cloudmonkey/cachemaker.py
@@ -100,7 +100,11 @@ def monkeycache(apis):
     cache['count'] = getvalue(apis[responsekey], 'count')
     cache['asyncapis'] = []
 
-    for api in getvalue(apis[responsekey], 'api'):
+    apilist = getvalue(apis[responsekey], 'api')
+    if apilist == None:
+        print "[monkeycache] Server response issue, no apis found"
+
+    for api in apilist:
         name = getvalue(api, 'name')
         verb, subject = splitverbsubject(name)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad5d1a4/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py 
b/tools/cli/cloudmonkey/cloudmonkey.py
index e94d530..a95ab9e 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -487,6 +487,7 @@ def main():
     if options.version:
         print "cloudmonkey", __version__
         print __description__, "(%s)" % __projecturl__
+        sys.exit(0)
 
     shell = CloudMonkeyShell(sys.argv[0], options.cfile)
     if len(args) > 1:

Reply via email to