cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [17/51] [abbrv] git commit: cli: Fix cachegen aand cloudmonkey to generate api verbs, revert last commit
Date Tue, 29 Jan 2013 21:25:15 GMT
cli: Fix cachegen aand cloudmonkey to generate api verbs, revert last commit

Fixes cachegen and reverts "mvn: fix cloudmonkey build"

This reverts commit 6d3de41d4262abeedab234a08e8fb5714b69a9bf.


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

Branch: refs/heads/ui-plugins
Commit: 6c527ffbbaeafd3a697f3f7bf3222e12646f7d22
Parents: 6d3de41
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Sun Jan 27 04:17:30 2013 -0800
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Sun Jan 27 04:18:31 2013 -0800

----------------------------------------------------------------------
 tools/cli/cloudmonkey/cachegen.py    |   11 ++++++++---
 tools/cli/cloudmonkey/cloudmonkey.py |    2 +-
 tools/cli/pom.xml                    |   14 ++++++++++++++
 3 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c527ffb/tools/cli/cloudmonkey/cachegen.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cachegen.py b/tools/cli/cloudmonkey/cachegen.py
index e03b6fd..509c0c6 100644
--- a/tools/cli/cloudmonkey/cachegen.py
+++ b/tools/cli/cloudmonkey/cachegen.py
@@ -16,11 +16,13 @@
 # under the License.
 
 try:
-    from common import grammar
+    import re
     from marvin.cloudstackAPI import *
     from marvin import cloudstackAPI
 except ImportError, e:
-    pass
+    import sys
+    print "ImportError", e
+    sys.exit(1)
 
 completions = cloudstackAPI.__all__
 
@@ -43,9 +45,12 @@ def main():
     completing commands and help docs. This reduces the overall search and
     cache_miss (computation) complexity from O(n) to O(1) for any valid cmd.
     """
+    pattern = re.compile("[A-Z]")
+    verbs = list(set([x[:pattern.search(x).start()] for x in completions
+                 if pattern.search(x) is not None]).difference(['cloudstack']))
     # datastructure {'verb': {cmd': ['api', [params], doc, required=[]]}}
     cache_verbs = {}
-    for verb in grammar:
+    for verb in verbs:
         completions_found = filter(lambda x: x.startswith(verb), completions)
         cache_verbs[verb] = {}
         for api_name in completions_found:

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c527ffb/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py
index aabcde5..ecd0c82 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -514,7 +514,7 @@ class CloudMonkeyShell(cmd.Cmd, object):
 def main():
     pattern = re.compile("[A-Z]")
     verbs = list(set([x[:pattern.search(x).start()] for x in completions
-                     if pattern.search(x) is not None]))
+                 if pattern.search(x) is not None]).difference(['cloudstack']))
     for verb in verbs:
         def add_grammar(verb):
             def grammar_closure(self, args):

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c527ffb/tools/cli/pom.xml
----------------------------------------------------------------------
diff --git a/tools/cli/pom.xml b/tools/cli/pom.xml
index c76cd65..aba5ec3 100644
--- a/tools/cli/pom.xml
+++ b/tools/cli/pom.xml
@@ -72,6 +72,20 @@
             </configuration>
           </execution>
           <execution>
+            <id>cachegen</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <workingDirectory>${basedir}/cloudmonkey</workingDirectory>
+              <executable>python</executable>
+              <arguments>
+                  <argument>cachegen.py</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <execution>
             <id>package</id>
             <phase>compile</phase>
             <goals>


Mime
View raw message