aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deployment/docker/src/main/docker/docker-compose.yaml1
-rw-r--r--framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java10
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/Constants.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java13
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java2
-rw-r--r--framework/src/main/resources/onap.properties2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java3
-rw-r--r--main/src/main/java/org/onap/cli/main/OnapCli.java14
8 files changed, 22 insertions, 25 deletions
diff --git a/deployment/docker/src/main/docker/docker-compose.yaml b/deployment/docker/src/main/docker/docker-compose.yaml
index aff1f859..f6273cb8 100644
--- a/deployment/docker/src/main/docker/docker-compose.yaml
+++ b/deployment/docker/src/main/docker/docker-compose.yaml
@@ -24,7 +24,6 @@ services:
tty: true
image: onap/cli
environment:
- CLI_DEV: "true"
CLI_MODE: 'console'
ONAP_CLI_DEBUG: "true"
expose:
diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
index 2a16cb79..72e22b51 100644
--- a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
+++ b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
@@ -58,8 +58,6 @@ public class OnapCommandRegistrar {
private boolean isInteractiveMode = false;
- private boolean isDevMode = Boolean.parseBoolean(System.getenv(Constants.CLI_DEV_MODE));
-
private OnapCommandParameterCache paramCache = OnapCommandParameterCache.getInstance();
public boolean isInteractiveMode() {
@@ -82,14 +80,6 @@ public class OnapCommandRegistrar {
paramCache.remove(this.getEnabledProductVersion(), paramName);
}
- public boolean isDevMode() {
- return isDevMode;
- }
-
- public void setDevMode(boolean isDevMode) {
- this.isDevMode = isDevMode;
- }
-
public void setProfile(String profileName) {
this.paramCache.setProfile(profileName);
}
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
index 17b771c0..e9e52baa 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
@@ -196,7 +196,7 @@ public class Constants {
public static final String PARAM_CACHE_FILE_NAME = "global-profile";
- public static final String CLI_DEV_MODE = "CLI_DEV";
+ public static final String DISCOVER_ALWAYS = "discover_always";
private Constants() {
}
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java
index b706ea66..249ec0e0 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java
@@ -62,6 +62,19 @@ public final class OnapCommandConfg {
return false;
}
+ /**
+ * is discovery should do every time.
+ *
+ * @return boolean
+ */
+ public static boolean isDiscoverAlways() {
+ if ("true".equals(prps.getProperty(Constants.DISCOVER_ALWAYS))) {
+ return true;
+ }
+
+ return false;
+ }
+
public static String getVersion() {
return prps.getProperty(Constants.ONAP_CLI_VERSION);
}
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
index 939c753a..77d50171 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
@@ -1682,7 +1682,7 @@ public class OnapCommandUtils {
*/
public static List<ExternalSchema> loadExternalSchemasFromJson() throws OnapCommandException {
List<ExternalSchema> schemas = new ArrayList<>();
- if (OnapCommandRegistrar.getRegistrar().isDevMode() || !isJsonFileDiscovered()) {
+ if (OnapCommandConfg.isDiscoverAlways() || !isJsonFileDiscovered()) {
schemas = findAllExternalSchemas();
if (!schemas.isEmpty()) {
persist(schemas);
diff --git a/framework/src/main/resources/onap.properties b/framework/src/main/resources/onap.properties
index 285e5c8a..77be05f3 100644
--- a/framework/src/main/resources/onap.properties
+++ b/framework/src/main/resources/onap.properties
@@ -1,7 +1,7 @@
cli.ignore_auth=false
cli.version=1.0
cli.http.api_key_use_cookies=true
-
+cli.discover_always=false
cli.service_name=onap-cli
cli.api_gateway=msb
cli.auth_service=auth
diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
index d123a875..c26678d7 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -147,9 +147,6 @@ public class OnapCommandRegistrarTest {
OnapCommandRegistrar.getRegistrar().getParamCache();
OnapCommandRegistrar.getRegistrar().removeParamCache("a");
- OnapCommandRegistrar.getRegistrar().setDevMode(true);
- OnapCommandRegistrar.getRegistrar().isDevMode();
-
OnapCommandRegistrar.getRegistrar().isInteractiveMode();
OnapCommandRegistrar.getRegistrar().setInteractiveMode(false);
diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java
index 9255da20..35df0e37 100644
--- a/main/src/main/java/org/onap/cli/main/OnapCli.java
+++ b/main/src/main/java/org/onap/cli/main/OnapCli.java
@@ -37,6 +37,8 @@ import org.onap.cli.fw.output.ResultType;
import org.onap.cli.main.conf.OnapCliConstants;
import org.onap.cli.main.interactive.StringCompleter;
import org.onap.cli.main.utils.OnapCliUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import jline.TerminalFactory;
import jline.console.ConsoleReader;
@@ -47,6 +49,8 @@ import jline.console.ConsoleReader;
*/
public class OnapCli {
+ private static Logger LOG = LoggerFactory.getLogger(OnapCli.class);
+
private List<String> args = new ArrayList<>();
private int exitCode = -1;
@@ -68,14 +72,8 @@ public class OnapCli {
}
private void print(Throwable throwable) {
- System.out.println(throwable.getMessage());
- try {
- if (OnapCommandRegistrar.getRegistrar().isDevMode()) {
- throwable.printStackTrace(); // NOSONAR
- }
- } catch (OnapCommandException e) {
- System.out.println(e);
- }
+ this.print(throwable.getMessage());
+ LOG.error(throwable.getMessage(), throwable);
}
private String getShortOption(String opt) {