cli: fix keyerror in help doc handler

- Check and then print help docs
- Add verb configure

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/a5ad9c3c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a5ad9c3c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a5ad9c3c

Branch: refs/heads/master
Commit: a5ad9c3c50dae2ddc2b872c473cff1bdb488e1b5
Parents: 860d1bc
Author: Rohit Yadav <[email protected]>
Authored: Wed Nov 7 16:05:01 2012 +0530
Committer: Rohit Yadav <[email protected]>
Committed: Wed Nov 7 16:05:01 2012 +0530

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


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a5ad9c3c/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py 
b/tools/cli/cloudmonkey/cloudmonkey.py
index 4eb0bc2..1f1896d 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -369,7 +369,12 @@ class CloudStackShell(cmd.Cmd):
             subject = fields[2].partition(" ")[0]
             if verb not in self.cache_verbs:
                 self.cache_verb_miss(verb)
-            self.print_shell(self.cache_verbs[verb][subject][2])
+
+            if subject in self.cache_verbs[verb]:
+                self.print_shell(self.cache_verbs[verb][subject][2])
+            else:
+                self.print_shell("Error: no such api (%s) on %s" %
+                                 (subject, verb))
 
     def complete_help(self, text, line, begidx, endidx):
         fields = line.partition(" ")
@@ -400,7 +405,7 @@ def main():
     # Add verbs in grammar
     grammar = ['create', 'list', 'delete', 'update',
                'enable', 'disable', 'add', 'remove', 'attach', 'detach',
-               'assign', 'authorize', 'change', 'register',
+               'assign', 'authorize', 'change', 'register', 'configure',
                'start', 'restart', 'reboot', 'stop', 'reconnect',
                'cancel', 'destroy', 'revoke',
                'copy', 'extract', 'migrate', 'restore',

Reply via email to