cloudmonkey: print sync stats, asks users to use sync

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2013-03-06 17:20:40 +05:30
parent 38aec6fc4d
commit cc9b7d4c20
2 changed files with 7 additions and 3 deletions

View File

@ -42,7 +42,7 @@ except ImportError, e:
try:
from precache import apicache
except ImportError:
apicache = {}
apicache = {'count': 0, 'verbs': [], 'asyncapis': []}
try:
import readline
@ -327,11 +327,14 @@ class CloudMonkeyShell(cmd.Cmd, object):
it rollbacks last datastore or api precached datastore.
"""
response = self.make_request("listApis")
self.apicache = monkeycache(response)
if response is None:
monkeyprint("Failed to sync apis, check your config")
monkeyprint("Failed to sync apis, please check your config?")
monkeyprint("Note: `sync` requires api discovery service enabled" +
" on the CloudStack management server")
return
self.apicache = monkeycache(response)
savecache(self.apicache, self.cache_file)
monkeyprint("%s APIs discovered and cached" % self.apicache["count"])
self.loadcache()
def do_api(self, args):

View File

@ -99,6 +99,7 @@ def read_config(get_attr, set_attr):
print "Welcome! Using `set` configure the necessary settings:"
print " ".join(sorted(config_options))
print "Config file:", config_file
print "After setting up, run the `sync` command to sync apis\n"
missing_keys = []
for section in config_fields.keys():