You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2018/08/16 01:14:28 UTC

[geode] branch develop updated: GEODE-3839: Warning when cache xml is used (#2271)

This is an automated email from the ASF dual-hosted git repository.

nnag pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 152701b  GEODE-3839: Warning when cache xml is used (#2271)
152701b is described below

commit 152701b4f51b1a6f00179327e2e72df046a85e00
Author: Nabarun Nag <na...@users.noreply.github.com>
AuthorDate: Wed Aug 15 18:14:21 2018 -0700

    GEODE-3839: Warning when cache xml is used (#2271)
    
            * Additional logs added when cache-xml file is used in start server gfsh command.
    	* A warning is logged mentioning that cluster config will take precedence over the cache-xml file provided in the command.
    	* start server command help updated with the above information.
---
 .../management/internal/cli/commands/StartServerCommand.java  | 11 ++++++++---
 .../apache/geode/management/internal/cli/i18n/CliStrings.java |  4 +++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
index 37020d9..829d89f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
@@ -202,9 +202,14 @@ public class StartServerCommand extends InternalGfshCommand {
 
     cacheXmlPathname = CliUtil.resolvePathname(cacheXmlPathname);
 
-    if (StringUtils.isNotBlank(cacheXmlPathname) && !IOUtils.isExistingPathname(cacheXmlPathname)) {
-      return ResultBuilder.createUserErrorResult(
-          CliStrings.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname));
+    if (StringUtils.isNotBlank(cacheXmlPathname)) {
+      if (!IOUtils.isExistingPathname(cacheXmlPathname)) {
+        return ResultBuilder.createUserErrorResult(
+            CliStrings.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname));
+      } else {
+        getGfsh().logWarning(
+            CliStrings.CLUSTER_CONFIG_PRECEDENCE_OVER_CACHE_XML_WARN + cacheXmlPathname, null);
+      }
     }
 
     if (gemfirePropertiesFile != null && !gemfirePropertiesFile.exists()) {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
index da553fa..c96b0da 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
@@ -170,6 +170,8 @@ public class CliStrings {
       "Unable to locate the Java executables and dependencies.  Please set the JAVA_HOME environment variable.";
   public static final String CACHE_XML_NOT_FOUND_MESSAGE =
       "Warning: The Geode cache XML file {0} could not be found.";
+  public static final String CLUSTER_CONFIG_PRECEDENCE_OVER_CACHE_XML_WARN =
+      "NOTE: If cluster configuration is enabled, then those settings will take precedence over: ";
   public static final String GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE =
       "Warning: The Geode {0}properties file {1} could not be found.";
   public static final String MEMBER_NOT_FOUND_ERROR_MESSAGE =
@@ -2473,7 +2475,7 @@ public class CliStrings {
       "The IP address on which the Server will be bound.  By default, the Server is bound to all local addresses.";
   public static final String START_SERVER__CACHE_XML_FILE = CACHE_XML_FILE;
   public static final String START_SERVER__CACHE_XML_FILE__HELP =
-      "Specifies the name of the XML file or resource to initialize the cache with when it is created.";
+      "Specifies the name of the cache XML file or resource to initialize the cache with when it is created. NOTE: If cluster configuration is enabled, then it will take precedence over this option";
   public static final String START_SERVER__CLASSPATH = "classpath";
   public static final String START_SERVER__CLASSPATH__HELP =
       "Location of user application classes required by the Server. The user classpath is prepended to the Server's classpath.";