Skip to content

Commit 6c527ff

Browse files
committed
cli: Fix cachegen aand cloudmonkey to generate api verbs, revert last commit
Fixes cachegen and reverts "mvn: fix cloudmonkey build" This reverts commit 6d3de41.
1 parent 6d3de41 commit 6c527ff

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

tools/cli/cloudmonkey/cachegen.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
# under the License.
1717

1818
try:
19-
from common import grammar
19+
import re
2020
from marvin.cloudstackAPI import *
2121
from marvin import cloudstackAPI
2222
except ImportError, e:
23-
pass
23+
import sys
24+
print "ImportError", e
25+
sys.exit(1)
2426

2527
completions = cloudstackAPI.__all__
2628

@@ -43,9 +45,12 @@ def main():
4345
completing commands and help docs. This reduces the overall search and
4446
cache_miss (computation) complexity from O(n) to O(1) for any valid cmd.
4547
"""
48+
pattern = re.compile("[A-Z]")
49+
verbs = list(set([x[:pattern.search(x).start()] for x in completions
50+
if pattern.search(x) is not None]).difference(['cloudstack']))
4651
# datastructure {'verb': {cmd': ['api', [params], doc, required=[]]}}
4752
cache_verbs = {}
48-
for verb in grammar:
53+
for verb in verbs:
4954
completions_found = filter(lambda x: x.startswith(verb), completions)
5055
cache_verbs[verb] = {}
5156
for api_name in completions_found:

tools/cli/cloudmonkey/cloudmonkey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def do_EOF(self, args):
514514
def main():
515515
pattern = re.compile("[A-Z]")
516516
verbs = list(set([x[:pattern.search(x).start()] for x in completions
517-
if pattern.search(x) is not None]))
517+
if pattern.search(x) is not None]).difference(['cloudstack']))
518518
for verb in verbs:
519519
def add_grammar(verb):
520520
def grammar_closure(self, args):

tools/cli/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@
7171
</arguments>
7272
</configuration>
7373
</execution>
74+
<execution>
75+
<id>cachegen</id>
76+
<phase>compile</phase>
77+
<goals>
78+
<goal>exec</goal>
79+
</goals>
80+
<configuration>
81+
<workingDirectory>${basedir}/cloudmonkey</workingDirectory>
82+
<executable>python</executable>
83+
<arguments>
84+
<argument>cachegen.py</argument>
85+
</arguments>
86+
</configuration>
87+
</execution>
7488
<execution>
7589
<id>package</id>
7690
<phase>compile</phase>

0 commit comments

Comments
 (0)