You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2014/10/29 08:26:58 UTC
git commit: cloudmonkey: if related API is not found,
found by list APIs
Repository: cloudstack-cloudmonkey
Updated Branches:
refs/heads/master af5d8f86e -> 35d405a18
cloudmonkey: if related API is not found, found by list APIs
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/35d405a1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/35d405a1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/35d405a1
Branch: refs/heads/master
Commit: 35d405a187116ac30be262557834cd16d5c63785
Parents: af5d8f8
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Wed Oct 29 12:56:39 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed Oct 29 12:56:39 2014 +0530
----------------------------------------------------------------------
cloudmonkey/cloudmonkey.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/35d405a1/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index a74439b..19a128d 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -386,7 +386,16 @@ class CloudMonkeyShell(cmd.Cmd, object):
params = self.apicache[verb][subject]['params']
related = filter(lambda x: x['name'] == param,
params)[0]['related']
- api = filter(lambda x: 'list' in x, related)[0]
+ api = ""
+ apis = filter(lambda x: 'list' in x, related)
+ if len(apis) > 0:
+ api = apis[0]
+ else:
+ entity = param.replace("id", "")
+ for verb in self.apicache["list"]:
+ if verb.startswith(entity):
+ api = self.apicache["list"][verb]['name']
+ break
uuids = []
if api in self.param_cache.keys() and self.param_cache[api]["ts"] > (int(time.time()) - 1000):
for option in self.param_cache[api]["options"]:
@@ -416,7 +425,7 @@ class CloudMonkeyShell(cmd.Cmd, object):
uuids.append(uuid)
if len(uuids) > 1:
- print "\n"
+ print
for option in self.param_cache[api]["options"]:
uuid = option[0]
name = option[1]