summaryrefslogtreecommitdiffstats
path: root/dcae-cli/dcae_cli/util/config.py
diff options
context:
space:
mode:
authorMichael Hwang <mhwang@research.att.com>2017-09-15 13:41:58 -0400
committerMichael Hwang <mhwang@research.att.com>2017-09-18 13:00:59 -0400
commit4188380fb7b806640103f557afec344455787a34 (patch)
treec5bbe244980f567012f6dbbcd1b3bb5ddc5ed37c /dcae-cli/dcae_cli/util/config.py
parent5a7ecc5f553c6416beb7327a55967287b0645d14 (diff)
Make server url into a user inputted config param
Change-Id: I90e94445fe0f3c003307355cade493e97d0a202d Issue-Id: DCAEGEN2-110 Signed-off-by: Michael Hwang <mhwang@research.att.com>
Diffstat (limited to 'dcae-cli/dcae_cli/util/config.py')
-rw-r--r--dcae-cli/dcae_cli/util/config.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/dcae-cli/dcae_cli/util/config.py b/dcae-cli/dcae_cli/util/config.py
index 4628681..6a53de4 100644
--- a/dcae-cli/dcae_cli/util/config.py
+++ b/dcae-cli/dcae_cli/util/config.py
@@ -50,12 +50,16 @@ def _init_config_user():
else:
click.echo("Invalid user id. Please try again.")
+def _init_config_server_url():
+ return click.prompt('Please enter the remote server url', type=str).strip()
def _init_config():
'''Returns an initial dict for populating the config'''
# Grab the remote config and merge it in
try:
- new_config = util.fetch_file_from_nexus("/dcae-cli/config.json")
+ server_url = _init_config_server_url()
+ new_config = util.fetch_file_from_web(server_url, "/dcae-cli/config.json")
+ new_config["server_url"] = server_url
except:
# REVIEW: Should we allow users to manually setup their config if not
# able to pull from remote server?
@@ -82,6 +86,13 @@ def get_config():
'''Returns the configuration dictionary'''
return get_pref(get_config_path(), _init_config)
+def get_server_url():
+ """Returns the remote server url
+
+ The remote server holds the artifacts that the dcae-cli requires like the
+ seed config json and seed profiles json, and json schemas.
+ """
+ return get_config().get("server_url")
# These functions are used to fetch the configurable path to the various json
# schema files used in validation.