From 0f1b9a1a06593919e497acbb5bb835244e8c774d Mon Sep 17 00:00:00 2001 From: Michael Hwang Date: Thu, 8 Feb 2018 17:26:40 -0500 Subject: Fix issues with initialization Change-Id: Ib9520e4f5bd1d257a9281a60ea55c5fd2704e948 Issue-ID: DCAEGEN2-322 Signed-off-by: Michael Hwang --- dcae-cli/README.md | 18 ++++++++++++++---- dcae-cli/dcae_cli/_version.py | 2 +- dcae-cli/dcae_cli/util/config.py | 7 ++++--- dcae-cli/dcae_cli/util/profiles.py | 5 +++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/dcae-cli/README.md b/dcae-cli/README.md index 2806f5e..c96e5e2 100644 --- a/dcae-cli/README.md +++ b/dcae-cli/README.md @@ -4,9 +4,21 @@ The `dcae-cli` is a Python command-line tool used to manage and to test componen ## Documentation -Please review the [DCAE platform documentation](ONAP URL TBD) which has a detailed [`dcae-cli` walkthrough](ONAP URL TBD). +Please review the [DCAE platform documentation](http://onap.readthedocs.io/en/latest/submodules/dcaegen2.git/docs/index.html) which has a detailed [`dcae-cli` walkthrough](http://onap.readthedocs.io/en/latest/submodules/dcaegen2.git/docs/sections/components/dcae-cli/walkthrough.html). -## Local use +## Usage + +You will be prompted to initialize the `dcae-cli` the first time you run the tool. You also have the option to [re-initializing using the `--reinit` flag](http://onap.readthedocs.io/en/latest/submodules/dcaegen2.git/docs/sections/components/dcae-cli/quickstart.html#reinit). + +You will be prompted to provide a remote server url. The remote server is expected to host several required artifacts that the `dcae-cli` requires like the json schemas to do validation. Use the following to use the bleeding edge: + +``` +Please enter the remote server url: https://git.onap.org/dcaegen2/platform/cli/plain +``` + +You will also be prompted for details on the postgres database to connect with. Follow the instructions below to run a local instance and provide the connection details in the initialization. + +### Local use The dcae-cli requires access to an onboarding catalog which is a postgres database. If there is no shared instance for your team or organization, then a workaround is to run a local instance of postgres on your machine. One quick way is to run a postgres Docker container: @@ -15,5 +27,3 @@ docker run -e POSTGRES_PASSWORD= -e PGDATA=/var/lib/postgresql/da ``` Use your favorite sql client to log into this local instance and create a database named `dcae_onboarding_db`. - -Now that your onboarding catalog is setup, run `dcae_cli --reinit` and walkthrough the prompts to configure your dcae-cli to point to this local instance. diff --git a/dcae-cli/dcae_cli/_version.py b/dcae-cli/dcae_cli/_version.py index 3f09935..329a73d 100644 --- a/dcae-cli/dcae_cli/_version.py +++ b/dcae-cli/dcae_cli/_version.py @@ -19,4 +19,4 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. # -*- coding: utf-8 -*- -__version__ = "2.9.0" +__version__ = "2.9.1" diff --git a/dcae-cli/dcae_cli/util/config.py b/dcae-cli/dcae_cli/util/config.py index 3d6ac0a..e3257af 100644 --- a/dcae-cli/dcae_cli/util/config.py +++ b/dcae-cli/dcae_cli/util/config.py @@ -69,7 +69,6 @@ def _init_config(): try: 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: # Failing to pull seed configuration from remote server is not considered # a problem. Just continue and give user the option to set it up @@ -77,6 +76,8 @@ def _init_config(): if not click.confirm("Could not download initial configuration from remote server. Attempt manually setting up?"): raise ConfigurationInitError("Could not setup dcae-cli configuration") + # UPDATE: Keeping the server url even though the config was not found there. + new_config["server_url"] = server_url new_config["user"] = _init_config_user() new_config["cli_version"] = _version.__version__ @@ -123,11 +124,11 @@ def get_docker_logins_key(): def get_path_component_spec(): return get_config().get("path_component_spec", - "/schemas/component-specification/dcae-cli-v1/component-spec-schema.json") + "/component-json-schemas/component-specification/dcae-cli-v1/component-spec-schema.json") def get_path_data_format(): return get_config().get("path_data_format", - "/schemas/data-format/dcae-cli-v1/data-format-schema.json") + "/component-json-schemas/data-format/dcae-cli-v1/data-format-schema.json") def get_active_profile(): return get_config().get("active_profile", None) diff --git a/dcae-cli/dcae_cli/util/profiles.py b/dcae-cli/dcae_cli/util/profiles.py index 34580d6..721b0aa 100644 --- a/dcae-cli/dcae_cli/util/profiles.py +++ b/dcae-cli/dcae_cli/util/profiles.py @@ -103,8 +103,9 @@ def reinit_profiles(): # a problem. Just continue and give user the option to use an empty # default. if click.confirm("Could not download initial profiles from remote server. Set empty default?"): - new_profiles = {"default": { "consul_host": "", "config_binding_service": "", - "cdap_broker": "", "docker_host": ""}} + new_profiles = {"default": { "consul_host": "", + "config_binding_service": "config_binding_service", + "cdap_broker": "cdap_broker", "docker_host": ""}} else: raise ProfilesInitError("Could not setup dcae-cli profiles") -- cgit 1.2.3-korg