Skip to content

Commit cc9b7d4

Browse files
committed
cloudmonkey: print sync stats, asks users to use sync
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 38aec6f commit cc9b7d4

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

tools/cli/cloudmonkey/cloudmonkey.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
try:
4343
from precache import apicache
4444
except ImportError:
45-
apicache = {}
45+
apicache = {'count': 0, 'verbs': [], 'asyncapis': []}
4646

4747
try:
4848
import readline
@@ -327,11 +327,14 @@ def do_sync(self, args):
327327
it rollbacks last datastore or api precached datastore.
328328
"""
329329
response = self.make_request("listApis")
330-
self.apicache = monkeycache(response)
331330
if response is None:
332-
monkeyprint("Failed to sync apis, check your config")
331+
monkeyprint("Failed to sync apis, please check your config?")
332+
monkeyprint("Note: `sync` requires api discovery service enabled" +
333+
" on the CloudStack management server")
333334
return
335+
self.apicache = monkeycache(response)
334336
savecache(self.apicache, self.cache_file)
337+
monkeyprint("%s APIs discovered and cached" % self.apicache["count"])
335338
self.loadcache()
336339

337340
def do_api(self, args):

tools/cli/cloudmonkey/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def read_config(get_attr, set_attr):
9999
print "Welcome! Using `set` configure the necessary settings:"
100100
print " ".join(sorted(config_options))
101101
print "Config file:", config_file
102+
print "After setting up, run the `sync` command to sync apis\n"
102103

103104
missing_keys = []
104105
for section in config_fields.keys():

0 commit comments

Comments
 (0)