Skip to content

Commit 233c0ad

Browse files
committed
cli: Fix common.py's cfg fields grouped under similarites like ui, core, user etc.
Changes config path to ~/.cloudmonkey this will break cfg path but all configs are still backward compatible. We need folder to put a lot of stuff that is coming for ex. themes and plugins Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 0720d25 commit 233c0ad

1 file changed

Lines changed: 32 additions & 14 deletions

File tree

tools/cli/cloudmonkey/common.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,43 @@
1717
# under the License.
1818

1919
# Use following rules for versioning:
20-
# <cloudstack major version>.<cloudstack minor version>.<cli increment>
21-
__version__ = "4.0.0"
20+
# <cloudstack version>-<cli increment, starts from 0>
21+
__version__ = "4.1.0-0"
2222

2323
try:
24+
from os.path import expanduser
2425
import os
2526
from precache import precached_verbs
2627
except ImportError, e:
2728
precached_verbs = {}
2829

29-
# Add config key:value
30-
config_file = os.path.expanduser('~/.cloudmonkey_config')
31-
config_fields = {'host': 'localhost', 'port': '8080',
32-
'protocol': 'http', 'path': '/client/api',
33-
'apikey': '', 'secretkey': '',
34-
'timeout': '3600', 'asyncblock': 'true',
35-
'prompt': '🐵 cloudmonkey>', 'color': 'true',
36-
'tabularize': 'false',
37-
'log_file':
38-
os.path.expanduser('~/.cloudmonkey_log'),
39-
'history_file':
40-
os.path.expanduser('~/.cloudmonkey_history')}
30+
param_type = ['boolean', 'date', 'float', 'integer', 'short', 'list',
31+
'long', 'object', 'map', 'string', 'tzdate', 'uuid']
4132

33+
config_dir = expanduser('~/.cloudmonkey')
34+
config_file = expanduser(config_dir + '/config')
35+
36+
# cloudmonkey config fields
37+
config_fields = {'core': {}, 'ui': {}, 'server': {}, 'user': {}}
38+
39+
# core
40+
config_fields['core']['cache_file'] = expanduser(config_dir + '/cache')
41+
config_fields['core']['history_file'] = expanduser(config_dir + '/history')
42+
config_fields['core']['log_file'] = expanduser(config_dir + '/log')
43+
44+
# ui
45+
config_fields['ui']['color'] = 'true'
46+
config_fields['ui']['prompt'] = '> '
47+
config_fields['ui']['tabularize'] = 'false'
48+
49+
# server
50+
config_fields['server']['asyncblock'] = 'true'
51+
config_fields['server']['host'] = 'localhost'
52+
config_fields['server']['path'] = '/client/api'
53+
config_fields['server']['port'] = '8080'
54+
config_fields['server']['protocol'] = 'http'
55+
config_fields['server']['timeout'] = '3600'
56+
57+
# user
58+
config_fields['user']['apikey'] = ''
59+
config_fields['user']['secretkey'] = ''

0 commit comments

Comments
 (0)