From 127243b83b38d81871613bf64f6d1e67e1047141 Mon Sep 17 00:00:00 2001 From: Rabi Panda Date: Thu, 18 Mar 2021 17:17:19 -0700 Subject: [PATCH] [Rename] Environment variables in entire repository. (#405) Rename all environment variables with prefix 'ES_' to 'OPENSEARCH_'. Signed-off-by: Rabi Panda --- .ci/java-versions.properties | 4 ++-- .ci/matrix-runtime-javas.yml | 2 +- .ci/os.ps1 | 8 ++++---- .ci/os.sh | 4 ++-- .ci/packer_cache.sh | 2 +- .../fake_git/remote/.ci/java-versions.properties | 4 ++-- .../gradle/test/ClusterFormationTasks.groovy | 14 +++++++------- .../org/opensearch/gradle/test/NodeInfo.groovy | 4 ++-- .../gradle/internal/BwcSetupExtension.java | 12 ++++++------ .../gradle/testclusters/OpenSearchNode.java | 14 +++++++------- .../org/opensearch/index/reindex/README.txt | 6 +++--- .../java/org/opensearch/systemd/SystemdPlugin.java | 6 +++--- .../org/opensearch/systemd/SystemdPluginTests.java | 2 +- .../opensearch/packaging/test/ArchiveTests.java | 2 +- .../org/opensearch/packaging/test/DockerTests.java | 2 +- .../packaging/test/KeystoreManagementTests.java | 8 ++++---- .../opensearch/packaging/test/PackageTests.java | 2 +- .../packaging/test/PackagingTestCase.java | 8 ++++---- .../opensearch/packaging/test/PluginCliTests.java | 2 +- .../packaging/test/WindowsServiceTests.java | 4 ++-- .../org/opensearch/packaging/util/Archives.java | 8 ++++---- qa/remote-clusters/docker-compose-oss.yml | 4 ++-- .../java/org/opensearch/bootstrap/Security.java | 2 +- 23 files changed, 62 insertions(+), 62 deletions(-) diff --git a/.ci/java-versions.properties b/.ci/java-versions.properties index 47e5c017e43..1e431ae83ad 100644 --- a/.ci/java-versions.properties +++ b/.ci/java-versions.properties @@ -4,7 +4,7 @@ # build and test Elasticsearch for this branch. Valid Java versions # are 'java' or 'openjdk' followed by the major release number. -ES_BUILD_JAVA=openjdk14 -ES_RUNTIME_JAVA=java8 +OPENSEARCH_BUILD_JAVA=openjdk14 +OPENSEARCH_RUNTIME_JAVA=java8 GRADLE_TASK=build GRADLE_EXTRA_ARGS= diff --git a/.ci/matrix-runtime-javas.yml b/.ci/matrix-runtime-javas.yml index 9ca4babef5b..0a1a2170ec6 100644 --- a/.ci/matrix-runtime-javas.yml +++ b/.ci/matrix-runtime-javas.yml @@ -5,7 +5,7 @@ # which Elasticsearch will be tested. Valid Java versions are 'java' # or 'openjdk' followed by the major release number. -ES_RUNTIME_JAVA: +OPENSEARCH_RUNTIME_JAVA: - java8 - java11 - openjdk14 diff --git a/.ci/os.ps1 b/.ci/os.ps1 index 0fa43c4b250..765ac862a8f 100644 --- a/.ci/os.ps1 +++ b/.ci/os.ps1 @@ -8,8 +8,8 @@ If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent } $AppProps = ConvertFrom-StringData (Get-Content .ci/java-versions.properties -raw) -$env:ES_BUILD_JAVA=$AppProps.ES_BUILD_JAVA -$env:ES_RUNTIME_JAVA=$AppProps.ES_RUNTIME_JAVA +$env:OPENSEARCH_BUILD_JAVA=$AppProps.OPENSEARCH_BUILD_JAVA +$env:OPENSEARCH_RUNTIME_JAVA=$AppProps.OPENSEARCH_RUNTIME_JAVA $ErrorActionPreference="Stop" $gradleInit = "C:\Users\$env:username\.gradle\init.d\" @@ -20,9 +20,9 @@ echo "Copy .ci/init.gradle to $gradleInit" Copy-Item .ci/init.gradle -Destination $gradleInit [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine") -$env:PATH="C:\Users\jenkins\.java\$env:ES_BUILD_JAVA\bin\;$env:PATH" +$env:PATH="C:\Users\jenkins\.java\$env:OPENSEARCH_BUILD_JAVA\bin\;$env:PATH" $env:JAVA_HOME=$null -$env:SYSTEM_JAVA_HOME="C:\Users\jenkins\.java\$env:ES_RUNTIME_JAVA" +$env:SYSTEM_JAVA_HOME="C:\Users\jenkins\.java\$env:OPENSEARCH_RUNTIME_JAVA" Remove-Item -Recurse -Force \tmp -ErrorAction Ignore New-Item -ItemType directory -Path \tmp diff --git a/.ci/os.sh b/.ci/os.sh index 59e8de36af1..01baeb1a4f2 100755 --- a/.ci/os.sh +++ b/.ci/os.sh @@ -23,8 +23,8 @@ sudo useradd vagrant set -e . .ci/java-versions.properties -RUNTIME_JAVA_HOME=$HOME/.java/$ES_RUNTIME_JAVA -BUILD_JAVA_HOME=$HOME/.java/$ES_BUILD_JAVA +RUNTIME_JAVA_HOME=$HOME/.java/$OPENSEARCH_RUNTIME_JAVA +BUILD_JAVA_HOME=$HOME/.java/$OPENSEARCH_BUILD_JAVA rm -Rfv $HOME/.gradle/init.d/ && mkdir -p $HOME/.gradle/init.d cp -v .ci/init.gradle $HOME/.gradle/init.d diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh index 3c42ab1274a..ea695cba932 100755 --- a/.ci/packer_cache.sh +++ b/.ci/packer_cache.sh @@ -16,7 +16,7 @@ while [ -h "$SCRIPT" ] ; do done source $(dirname "${SCRIPT}")/java-versions.properties -export JAVA_HOME="${HOME}"/.java/${ES_BUILD_JAVA} +export JAVA_HOME="${HOME}"/.java/${OPENSEARCH_BUILD_JAVA} # We are caching BWC versions too, need these so we can build those export JAVA8_HOME="${HOME}"/.java/java8 export JAVA11_HOME="${HOME}"/.java/java11 diff --git a/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/.ci/java-versions.properties b/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/.ci/java-versions.properties index 1337f4013e6..71f5afa9bc1 100644 --- a/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/.ci/java-versions.properties +++ b/buildSrc/src/integTest/resources/org/opensearch/gradle/internal/fake_git/remote/.ci/java-versions.properties @@ -16,6 +16,6 @@ # specific language governing permissions and limitations # under the License. # -ES_BUILD_JAVA=openjdk14 -ES_RUNTIME_JAVA=openjdk14 +OPENSEARCH_BUILD_JAVA=openjdk14 +OPENSEARCH_RUNTIME_JAVA=openjdk14 GRADLE_TASK=build diff --git a/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy index 6da8d499787..1a40cb05235 100644 --- a/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/opensearch/gradle/test/ClusterFormationTasks.groovy @@ -758,24 +758,24 @@ class ClusterFormationTasks { } // Configure ES JAVA OPTS - adds system properties, assertion flags, remote debug etc - List esJavaOpts = [node.env.get('ES_JAVA_OPTS', '')] + List opensearchJavaOpts = [node.env.get('OPENSEARCH_JAVA_OPTS', '')] String collectedSystemProperties = node.config.systemProperties.collect { key, value -> "-D${key}=${value}" }.join(" ") - esJavaOpts.add(collectedSystemProperties) - esJavaOpts.add(node.config.jvmArgs) + opensearchJavaOpts.add(collectedSystemProperties) + opensearchJavaOpts.add(node.config.jvmArgs) if (Boolean.parseBoolean(System.getProperty('tests.asserts', 'true'))) { // put the enable assertions options before other options to allow // flexibility to disable assertions for specific packages or classes // in the cluster-specific options - esJavaOpts.add("-ea") - esJavaOpts.add("-esa") + opensearchJavaOpts.add("-ea") + opensearchJavaOpts.add("-esa") } // we must add debug options inside the closure so the config is read at execution time, as // gradle task options are not processed until the end of the configuration phase if (node.config.debug) { println 'Running opensearch in debug mode, suspending until connected on port 8000' - esJavaOpts.add('-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000') + opensearchJavaOpts.add('-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000') } - node.env['ES_JAVA_OPTS'] = esJavaOpts.join(" ") + node.env['OPENSEARCH_JAVA_OPTS'] = opensearchJavaOpts.join(" ") // project.logger.info("Starting node in ${node.clusterName} distribution: ${node.config.distribution}") diff --git a/buildSrc/src/main/groovy/org/opensearch/gradle/test/NodeInfo.groovy b/buildSrc/src/main/groovy/org/opensearch/gradle/test/NodeInfo.groovy index e4ea3f113ee..8d387cba916 100644 --- a/buildSrc/src/main/groovy/org/opensearch/gradle/test/NodeInfo.groovy +++ b/buildSrc/src/main/groovy/org/opensearch/gradle/test/NodeInfo.groovy @@ -197,10 +197,10 @@ class NodeInfo { * We have to delay building the string as the path will not exist during configuration which will fail on Windows due to * getting the short name requiring the path to already exist. */ - env.put('ES_PATH_CONF', "${-> getShortPathName(pathConf.toString())}") + env.put('OPENSEARCH_PATH_CONF', "${-> getShortPathName(pathConf.toString())}") } else { - env.put('ES_PATH_CONF', pathConf) + env.put('OPENSEARCH_PATH_CONF', pathConf) } if (!System.properties.containsKey("tests.opensearch.path.data")) { if (Os.isFamily(Os.FAMILY_WINDOWS)) { diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/BwcSetupExtension.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/BwcSetupExtension.java index b307b34f7ba..88582a75de3 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/BwcSetupExtension.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/BwcSetupExtension.java @@ -81,9 +81,9 @@ public class BwcSetupExtension { Integer.parseInt( Arrays.asList(javaVersionsString.split("\n")) .stream() - .filter(l -> l.trim().startsWith("ES_BUILD_JAVA=")) - .map(l -> l.replace("ES_BUILD_JAVA=java", "").trim()) - .map(l -> l.replace("ES_BUILD_JAVA=openjdk", "").trim()) + .filter(l -> l.trim().startsWith("OPENSEARCH_BUILD_JAVA=")) + .map(l -> l.replace("OPENSEARCH_BUILD_JAVA=java", "").trim()) + .map(l -> l.replace("OPENSEARCH_BUILD_JAVA=openjdk", "").trim()) .collect(Collectors.joining("!!")) ) ) @@ -94,9 +94,9 @@ public class BwcSetupExtension { Integer.parseInt( Arrays.asList(javaVersionsString.split("\n")) .stream() - .filter(l -> l.trim().startsWith("ES_RUNTIME_JAVA=")) - .map(l -> l.replace("ES_RUNTIME_JAVA=java", "").trim()) - .map(l -> l.replace("ES_RUNTIME_JAVA=openjdk", "").trim()) + .filter(l -> l.trim().startsWith("OPENSEARCH_RUNTIME_JAVA=")) + .map(l -> l.replace("OPENSEARCH_RUNTIME_JAVA=java", "").trim()) + .map(l -> l.replace("OPENSEARCH_RUNTIME_JAVA=openjdk", "").trim()) .collect(Collectors.joining("!!")) ) ) diff --git a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java index 68c7995d6e2..f29f6fcbc5b 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java @@ -729,17 +729,17 @@ public class OpenSearchNode implements TestClusterConfiguration { private Map getESEnvironment() { Map defaultEnv = new HashMap<>(); getRequiredJavaHome().ifPresent(javaHome -> defaultEnv.put("JAVA_HOME", javaHome)); - defaultEnv.put("ES_PATH_CONF", configFile.getParent().toString()); + defaultEnv.put("OPENSEARCH_PATH_CONF", configFile.getParent().toString()); String systemPropertiesString = ""; if (systemProperties.isEmpty() == false) { systemPropertiesString = " " + systemProperties.entrySet() .stream() .map(entry -> "-D" + entry.getKey() + "=" + entry.getValue()) - // ES_PATH_CONF is also set as an environment variable and for a reference to ${ES_PATH_CONF} - // to work ES_JAVA_OPTS, we need to make sure that ES_PATH_CONF before ES_JAVA_OPTS. Instead, + // OPENSEARCH_PATH_CONF is also set as an environment variable and for a reference to ${OPENSEARCH_PATH_CONF} + // to work OPENSEARCH_JAVA_OPTS, we need to make sure that OPENSEARCH_PATH_CONF before OPENSEARCH_JAVA_OPTS. Instead, // we replace the reference with the actual value in other environment variables - .map(p -> p.replace("${ES_PATH_CONF}", configFile.getParent().toString())) + .map(p -> p.replace("${OPENSEARCH_PATH_CONF}", configFile.getParent().toString())) .collect(Collectors.joining(" ")); } String jvmArgsString = ""; @@ -754,13 +754,13 @@ public class OpenSearchNode implements TestClusterConfiguration { } String heapSize = System.getProperty("tests.heap.size", "512m"); defaultEnv.put( - "ES_JAVA_OPTS", + "OPENSEARCH_JAVA_OPTS", "-Xms" + heapSize + " -Xmx" + heapSize + " -ea -esa " + systemPropertiesString + " " + jvmArgsString + " " + // Support passing in additional JVM arguments System.getProperty("tests.jvm.argline", "") ); - defaultEnv.put("ES_TMPDIR", tmpDir.toString()); - // Windows requires this as it defaults to `c:\windows` despite ES_TMPDIR + defaultEnv.put("OPENSEARCH_TMPDIR", tmpDir.toString()); + // Windows requires this as it defaults to `c:\windows` despite OPENSEARCH_TMPDIR defaultEnv.put("TMP", tmpDir.toString()); // Override the system hostname variables for testing diff --git a/modules/reindex/src/test/resources/org/opensearch/index/reindex/README.txt b/modules/reindex/src/test/resources/org/opensearch/index/reindex/README.txt index 4221d479442..efc6cbb196b 100644 --- a/modules/reindex/src/test/resources/org/opensearch/index/reindex/README.txt +++ b/modules/reindex/src/test/resources/org/opensearch/index/reindex/README.txt @@ -1,6 +1,6 @@ # ca.p12 -$ES_HOME/bin/elasticsearch-certutil ca --out ca.p12 --pass "ca-password" --days 9999 +$OPENSEARCH_HOME/bin/elasticsearch-certutil ca --out ca.p12 --pass "ca-password" --days 9999 # ca.pem @@ -8,7 +8,7 @@ openssl pkcs12 -info -in ./ca.p12 -nokeys -out ca.pem -passin "pass:ca-password" # http.p12 -$ES_HOME/bin/elasticsearch-certutil cert --out http.zip --pass "http-password" \ +$OPENSEARCH_HOME/bin/elasticsearch-certutil cert --out http.zip --pass "http-password" \ --days 9999 --pem --name "http" \ --ca ca.p12 --ca-pass "ca-password" \ --dns=localhost --dns=localhost.localdomain --dns=localhost4 --dns=localhost4.localdomain4 --dns=localhost6 --dns=localhost6.localdomain6 \ @@ -18,7 +18,7 @@ rm http.zip # client.p12 -$ES_HOME/bin/elasticsearch-certutil cert --out client.zip --pass "client-password" \ +$OPENSEARCH_HOME/bin/elasticsearch-certutil cert --out client.zip --pass "client-password" \ --name "client" --days 9999 --pem \ --ca ca.p12 --ca-pass "ca-password" unzip client.zip diff --git a/modules/systemd/src/main/java/org/opensearch/systemd/SystemdPlugin.java b/modules/systemd/src/main/java/org/opensearch/systemd/SystemdPlugin.java index 92500396294..b14c5bb3887 100644 --- a/modules/systemd/src/main/java/org/opensearch/systemd/SystemdPlugin.java +++ b/modules/systemd/src/main/java/org/opensearch/systemd/SystemdPlugin.java @@ -55,7 +55,7 @@ public class SystemdPlugin extends Plugin implements ClusterPlugin { @SuppressWarnings("unused") public SystemdPlugin() { - this(true, Build.CURRENT.type(), System.getenv("ES_SD_NOTIFY")); + this(true, Build.CURRENT.type(), System.getenv("OPENSEARCH_SD_NOTIFY")); } SystemdPlugin(final boolean assertIsPackageDistribution, final Build.Type buildType, final String esSDNotify) { @@ -69,13 +69,13 @@ public class SystemdPlugin extends Plugin implements ClusterPlugin { enabled = false; return; } - logger.trace("ES_SD_NOTIFY is set to [{}]", esSDNotify); + logger.trace("OPENSEARCH_SD_NOTIFY is set to [{}]", esSDNotify); if (esSDNotify == null) { enabled = false; return; } if (Boolean.TRUE.toString().equals(esSDNotify) == false && Boolean.FALSE.toString().equals(esSDNotify) == false) { - throw new RuntimeException("ES_SD_NOTIFY set to unexpected value [" + esSDNotify + "]"); + throw new RuntimeException("OPENSEARCH_SD_NOTIFY set to unexpected value [" + esSDNotify + "]"); } enabled = Boolean.TRUE.toString().equals(esSDNotify); } diff --git a/modules/systemd/src/test/java/org/opensearch/systemd/SystemdPluginTests.java b/modules/systemd/src/test/java/org/opensearch/systemd/SystemdPluginTests.java index 4b57557dcb8..f35deaafd74 100644 --- a/modules/systemd/src/test/java/org/opensearch/systemd/SystemdPluginTests.java +++ b/modules/systemd/src/test/java/org/opensearch/systemd/SystemdPluginTests.java @@ -93,7 +93,7 @@ public class SystemdPluginTests extends OpenSearchTestCase { () -> randomAlphaOfLength(4)); final RuntimeException e = expectThrows(RuntimeException.class, () -> new SystemdPlugin(false, randomPackageBuildType, esSDNotify)); - assertThat(e, hasToString(containsString("ES_SD_NOTIFY set to unexpected value [" + esSDNotify + "]"))); + assertThat(e, hasToString(containsString("OPENSEARCH_SD_NOTIFY set to unexpected value [" + esSDNotify + "]"))); } public void testOnNodeStartedSuccess() { diff --git a/qa/os/src/test/java/org/opensearch/packaging/test/ArchiveTests.java b/qa/os/src/test/java/org/opensearch/packaging/test/ArchiveTests.java index e73488ad484..2c97b077bfb 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/test/ArchiveTests.java +++ b/qa/os/src/test/java/org/opensearch/packaging/test/ArchiveTests.java @@ -250,7 +250,7 @@ public class ArchiveTests extends PackagingTestCase { final List jvmOptions = org.opensearch.common.collect.List.of("-Xms512m", "-Xmx512m", "-Dlog4j2.disable.jmx=true"); Files.write(tempConf.resolve("jvm.options"), jvmOptions, CREATE, APPEND); - sh.getEnv().put("ES_JAVA_OPTS", "-XX:-UseCompressedOops"); + sh.getEnv().put("OPENSEARCH_JAVA_OPTS", "-XX:-UseCompressedOops"); startOpenSearch(); diff --git a/qa/os/src/test/java/org/opensearch/packaging/test/DockerTests.java b/qa/os/src/test/java/org/opensearch/packaging/test/DockerTests.java index 343b9d66217..acfb3be84fa 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/test/DockerTests.java +++ b/qa/os/src/test/java/org/opensearch/packaging/test/DockerTests.java @@ -167,7 +167,7 @@ public class DockerTests extends PackagingTestCase { // Restart the container final Map volumes = singletonMap(tempDir, Paths.get("/usr/share/opensearch/config")); - final Map envVars = singletonMap("ES_JAVA_OPTS", "-XX:-UseCompressedOops"); + final Map envVars = singletonMap("OPENSEARCH_JAVA_OPTS", "-XX:-UseCompressedOops"); runContainer(distribution(), volumes, envVars); waitForOpenSearch(installation); diff --git a/qa/os/src/test/java/org/opensearch/packaging/test/KeystoreManagementTests.java b/qa/os/src/test/java/org/opensearch/packaging/test/KeystoreManagementTests.java index 07acb129dde..edd3d79508b 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/test/KeystoreManagementTests.java +++ b/qa/os/src/test/java/org/opensearch/packaging/test/KeystoreManagementTests.java @@ -259,7 +259,7 @@ public class KeystoreManagementTests extends PackagingTestCase { assertPasswordProtectedKeystore(); try { - sh.run("sudo systemctl set-environment ES_KEYSTORE_PASSPHRASE_FILE=" + esKeystorePassphraseFile); + sh.run("sudo systemctl set-environment OPENSEARCH_KEYSTORE_PASSPHRASE_FILE=" + esKeystorePassphraseFile); Files.createFile(esKeystorePassphraseFile); Files.write(esKeystorePassphraseFile, singletonList(password)); @@ -268,7 +268,7 @@ public class KeystoreManagementTests extends PackagingTestCase { ServerUtils.runOpenSearchTests(); stopOpenSearch(); } finally { - sh.run("sudo systemctl unset-environment ES_KEYSTORE_PASSPHRASE_FILE"); + sh.run("sudo systemctl unset-environment OPENSEARCH_KEYSTORE_PASSPHRASE_FILE"); } } @@ -279,7 +279,7 @@ public class KeystoreManagementTests extends PackagingTestCase { assertPasswordProtectedKeystore(); try { - sh.run("sudo systemctl set-environment ES_KEYSTORE_PASSPHRASE_FILE=" + esKeystorePassphraseFile); + sh.run("sudo systemctl set-environment OPENSEARCH_KEYSTORE_PASSPHRASE_FILE=" + esKeystorePassphraseFile); if (Files.exists(esKeystorePassphraseFile)) { rm(esKeystorePassphraseFile); @@ -292,7 +292,7 @@ public class KeystoreManagementTests extends PackagingTestCase { Shell.Result result = runOpenSearchStartCommand(null, false, false); assertOpenSearchFailure(result, Arrays.asList(ERROR_INCORRECT_PASSWORD, ERROR_CORRUPTED_KEYSTORE), journaldWrapper); } finally { - sh.run("sudo systemctl unset-environment ES_KEYSTORE_PASSPHRASE_FILE"); + sh.run("sudo systemctl unset-environment OPENSEARCH_KEYSTORE_PASSPHRASE_FILE"); } } diff --git a/qa/os/src/test/java/org/opensearch/packaging/test/PackageTests.java b/qa/os/src/test/java/org/opensearch/packaging/test/PackageTests.java index ef25f046ad8..c53003b85c9 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/test/PackageTests.java +++ b/qa/os/src/test/java/org/opensearch/packaging/test/PackageTests.java @@ -303,7 +303,7 @@ public class PackageTests extends PackagingTestCase { stopOpenSearch(); withCustomConfig(tempConf -> { - append(installation.envFile, "ES_JAVA_OPTS=-XX:-UseCompressedOops"); + append(installation.envFile, "OPENSEARCH_JAVA_OPTS=-XX:-UseCompressedOops"); startOpenSearch(); diff --git a/qa/os/src/test/java/org/opensearch/packaging/test/PackagingTestCase.java b/qa/os/src/test/java/org/opensearch/packaging/test/PackagingTestCase.java index 07396487afb..7ea4c8144e2 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/test/PackagingTestCase.java +++ b/qa/os/src/test/java/org/opensearch/packaging/test/PackagingTestCase.java @@ -376,7 +376,7 @@ public abstract class PackagingTestCase extends Assert { // In Windows, we have written our stdout and stderr to files in order to run // in the background String wrapperPid = result.stdout.trim(); - sh.runIgnoreExitCode("Wait-Process -Timeout " + Archives.ES_STARTUP_SLEEP_TIME_SECONDS + " -Id " + wrapperPid); + sh.runIgnoreExitCode("Wait-Process -Timeout " + Archives.OPENSEARCH_STARTUP_SLEEP_TIME_SECONDS + " -Id " + wrapperPid); sh.runIgnoreExitCode( "Get-EventSubscriber | " + "where {($_.EventName -eq 'OutputDataReceived' -Or $_.EventName -eq 'ErrorDataReceived' |" @@ -432,9 +432,9 @@ public abstract class PackagingTestCase extends Assert { if (distribution.isPackage()) { Files.copy(installation.envFile, tempDir.resolve("opensearch.bk"));// backup - append(installation.envFile, "ES_PATH_CONF=" + tempConf + "\n"); + append(installation.envFile, "OPENSEARCH_PATH_CONF=" + tempConf + "\n"); } else { - sh.getEnv().put("ES_PATH_CONF", tempConf.toString()); + sh.getEnv().put("OPENSEARCH_PATH_CONF", tempConf.toString()); } action.accept(tempConf); @@ -442,7 +442,7 @@ public abstract class PackagingTestCase extends Assert { IOUtils.rm(installation.envFile); Files.copy(tempDir.resolve("opensearch.bk"), installation.envFile); } else { - sh.getEnv().remove("ES_PATH_CONF"); + sh.getEnv().remove("OPENSEARCH_PATH_CONF"); } IOUtils.rm(tempDir); } diff --git a/qa/os/src/test/java/org/opensearch/packaging/test/PluginCliTests.java b/qa/os/src/test/java/org/opensearch/packaging/test/PluginCliTests.java index 6947038afd9..5b4c38fcf4b 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/test/PluginCliTests.java +++ b/qa/os/src/test/java/org/opensearch/packaging/test/PluginCliTests.java @@ -117,7 +117,7 @@ public class PluginCliTests extends PackagingTestCase { } public void test24JavaOpts() throws Exception { - sh.getEnv().put("ES_JAVA_OPTS", "-XX:+PrintFlagsFinal"); + sh.getEnv().put("OPENSEARCH_JAVA_OPTS", "-XX:+PrintFlagsFinal"); assertWithExamplePlugin(installResult -> assertThat(installResult.stdout, containsString("MaxHeapSize"))); } diff --git a/qa/os/src/test/java/org/opensearch/packaging/test/WindowsServiceTests.java b/qa/os/src/test/java/org/opensearch/packaging/test/WindowsServiceTests.java index 67a03bc881f..a677d3888f1 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/test/WindowsServiceTests.java +++ b/qa/os/src/test/java/org/opensearch/packaging/test/WindowsServiceTests.java @@ -273,11 +273,11 @@ public class WindowsServiceTests extends PackagingTestCase { } public void test80JavaOptsInEnvVar() throws Exception { - sh.getEnv().put("ES_JAVA_OPTS", "-Xmx2g -Xms2g"); + sh.getEnv().put("OPENSEARCH_JAVA_OPTS", "-Xmx2g -Xms2g"); sh.run(serviceScript + " install"); assertCommand(serviceScript + " start"); assertStartedAndStop(); - sh.getEnv().remove("ES_JAVA_OPTS"); + sh.getEnv().remove("OPENSEARCH_JAVA_OPTS"); } public void test81JavaOptsInJvmOptions() throws Exception { diff --git a/qa/os/src/test/java/org/opensearch/packaging/util/Archives.java b/qa/os/src/test/java/org/opensearch/packaging/util/Archives.java index 4bce5600006..b998cd07298 100644 --- a/qa/os/src/test/java/org/opensearch/packaging/util/Archives.java +++ b/qa/os/src/test/java/org/opensearch/packaging/util/Archives.java @@ -65,7 +65,7 @@ public class Archives { /** This is an arbitrarily chosen value that gives OpenSearch time to log Bootstrap * errors to the console if they occur before the logging framework is initialized. */ - public static final String ES_STARTUP_SLEEP_TIME_SECONDS = "10"; + public static final String OPENSEARCH_STARTUP_SLEEP_TIME_SECONDS = "10"; public static Installation installArchive(Shell sh, Distribution distribution) throws Exception { return installArchive(sh, distribution, getDefaultArchiveInstallPath(), getCurrentVersion()); @@ -233,7 +233,7 @@ public class Archives { keystorePassword ); - sh.getEnv().put("ES_STARTUP_SLEEP_TIME", ES_STARTUP_SLEEP_TIME_SECONDS); + sh.getEnv().put("OPENSEARCH_STARTUP_SLEEP_TIME", OPENSEARCH_STARTUP_SLEEP_TIME_SECONDS); return sh.runIgnoreExitCode(script); } @@ -258,7 +258,7 @@ public class Archives { } // We need to give OpenSearch enough time to print failures to stderr before exiting - sh.getEnv().put("ES_STARTUP_SLEEP_TIME", ES_STARTUP_SLEEP_TIME_SECONDS); + sh.getEnv().put("OPENSEARCH_STARTUP_SLEEP_TIME", OPENSEARCH_STARTUP_SLEEP_TIME_SECONDS); List command = new ArrayList<>(); command.add("sudo -E -u "); @@ -332,7 +332,7 @@ public class Archives { + keystorePassword + "'); " + "Wait-Process -Timeout " - + ES_STARTUP_SLEEP_TIME_SECONDS + + OPENSEARCH_STARTUP_SLEEP_TIME_SECONDS + " -Id $process.Id; " + "$process.Id;" ); diff --git a/qa/remote-clusters/docker-compose-oss.yml b/qa/remote-clusters/docker-compose-oss.yml index 599fc6bfc54..e484a5758f6 100644 --- a/qa/remote-clusters/docker-compose-oss.yml +++ b/qa/remote-clusters/docker-compose-oss.yml @@ -9,7 +9,7 @@ services: - cluster.name=opensearch-oss-1 - bootstrap.memory_lock=true - network.publish_host=127.0.0.1 - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" - path.repo=/tmp/opensearch-repo - node.attr.testattr=test - cluster.routing.allocation.disk.watermark.low=1b @@ -43,7 +43,7 @@ services: - cluster.name=opensearch-oss-2 - bootstrap.memory_lock=true - network.publish_host=127.0.0.1 - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" - path.repo=/tmp/opensearch-repo - node.attr.testattr=test - cluster.routing.allocation.disk.watermark.low=1b diff --git a/server/src/main/java/org/opensearch/bootstrap/Security.java b/server/src/main/java/org/opensearch/bootstrap/Security.java index b6cf1c1fce9..d7dee72c170 100644 --- a/server/src/main/java/org/opensearch/bootstrap/Security.java +++ b/server/src/main/java/org/opensearch/bootstrap/Security.java @@ -94,7 +94,7 @@ import static org.opensearch.bootstrap.FilePermissionUtils.addSingleFilePath; *

Debugging Security

* A good place to start when there is a problem is to turn on security debugging: *
- * ES_JAVA_OPTS="-Djava.security.debug=access,failure" bin/opensearch
+ * OPENSEARCH_JAVA_OPTS="-Djava.security.debug=access,failure" bin/opensearch
  * 
*

* When running tests you have to pass it to the test runner like this: