Add distribution type to startup scripts
This commit adds the distribution type to the startup scripts so that we can discern from log output and the main response the type of the distribution (deb/rpm/tar/zip).
This commit is contained in:
parent
c7f6b35485
commit
d99d0fa669
|
@ -42,6 +42,8 @@ public class PingAndInfoIT extends ESRestHighLevelClientTestCase {
|
|||
// only check node name existence, might be a different one from what was hit by low level client in multi-node cluster
|
||||
assertNotNull(info.getNodeName());
|
||||
Map<String, Object> versionMap = (Map<String, Object>) infoAsMap.get("version");
|
||||
assertEquals(versionMap.get("build_flavor"), info.getBuild().flavor().displayName());
|
||||
assertEquals(versionMap.get("build_type"), info.getBuild().type().displayName());
|
||||
assertEquals(versionMap.get("build_hash"), info.getBuild().shortHash());
|
||||
assertEquals(versionMap.get("build_date"), info.getBuild().date());
|
||||
assertEquals(versionMap.get("build_snapshot"), info.getBuild().isSnapshot());
|
||||
|
|
|
@ -42,23 +42,23 @@ task createPluginsDir(type: EmptyDirTask) {
|
|||
dirMode 0755
|
||||
}
|
||||
|
||||
CopySpec archiveFiles(CopySpec modulesFiles, boolean oss) {
|
||||
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, boolean oss) {
|
||||
return copySpec {
|
||||
into("elasticsearch-${version}") {
|
||||
with libFiles
|
||||
into('config') {
|
||||
dirMode 0750
|
||||
fileMode 0660
|
||||
with configFiles('def', oss)
|
||||
with configFiles(distributionType, oss)
|
||||
}
|
||||
into('bin') {
|
||||
with binFiles('def', oss)
|
||||
with binFiles(distributionType, oss)
|
||||
with copySpec {
|
||||
from('../src/bin') {
|
||||
include '*.bat'
|
||||
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
|
||||
}
|
||||
MavenFilteringHack.filter(it, expansionsForDistribution('def', oss))
|
||||
MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, oss))
|
||||
}
|
||||
}
|
||||
into('') {
|
||||
|
@ -101,15 +101,15 @@ tasks.withType(AbstractArchiveTask) {
|
|||
}
|
||||
|
||||
task buildIntegTestZip(type: Zip) {
|
||||
with archiveFiles(transportModulesFiles, false)
|
||||
with archiveFiles(transportModulesFiles, 'zip', false)
|
||||
}
|
||||
|
||||
task buildZip(type: Zip) {
|
||||
with archiveFiles(modulesFiles(false), false)
|
||||
with archiveFiles(modulesFiles(false), 'zip', false)
|
||||
}
|
||||
|
||||
task buildOssZip(type: Zip) {
|
||||
with archiveFiles(modulesFiles(true), true)
|
||||
with archiveFiles(modulesFiles(true), 'zip', true)
|
||||
}
|
||||
|
||||
Closure commonTarConfig = {
|
||||
|
@ -121,12 +121,12 @@ Closure commonTarConfig = {
|
|||
|
||||
task buildTar(type: Tar) {
|
||||
configure(commonTarConfig)
|
||||
with archiveFiles(modulesFiles(false), false)
|
||||
with archiveFiles(modulesFiles(false), 'tar', false)
|
||||
}
|
||||
|
||||
task buildOssTar(type: Tar) {
|
||||
configure(commonTarConfig)
|
||||
with archiveFiles(modulesFiles(true), true)
|
||||
with archiveFiles(modulesFiles(true), 'tar', true)
|
||||
}
|
||||
|
||||
// This configures the default artifact for the distribution specific
|
||||
|
|
|
@ -434,6 +434,14 @@ subprojects {
|
|||
'def': oss ? 'oss' : 'default'
|
||||
],
|
||||
|
||||
|
||||
'es.distribution.type': [
|
||||
'deb': 'deb',
|
||||
'rpm': 'rpm',
|
||||
'tar': 'tar',
|
||||
'zip': 'zip'
|
||||
],
|
||||
|
||||
'license.name': [
|
||||
'deb': oss ? 'ASL-2.0' : 'Elastic-License'
|
||||
],
|
||||
|
|
|
@ -29,6 +29,7 @@ if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' > /dev/null;
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.bootstrap.Elasticsearch \
|
||||
"$@"
|
||||
|
@ -39,6 +40,7 @@ else
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.bootstrap.Elasticsearch \
|
||||
"$@" \
|
||||
|
|
|
@ -78,6 +78,7 @@ fi
|
|||
ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd`
|
||||
|
||||
ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor}
|
||||
ES_DISTRIBUTION_TYPE=${es.distribution.type}
|
||||
|
||||
if [ -z "$ES_TMPDIR" ]; then
|
||||
set +e
|
||||
|
|
|
@ -54,6 +54,7 @@ rem now make ES_PATH_CONF absolute
|
|||
for %%I in ("%ES_PATH_CONF%..") do set ES_PATH_CONF=%%~dpfI
|
||||
|
||||
set ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor}
|
||||
set ES_DISTRIBUTION_TYPE=${es.distribution.type}
|
||||
|
||||
if not defined ES_TMPDIR (
|
||||
set ES_TMPDIR=!TMP!\elasticsearch
|
||||
|
|
|
@ -8,6 +8,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.common.settings.KeyStoreCli \
|
||||
"$@"
|
||||
|
|
|
@ -10,6 +10,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.common.settings.KeyStoreCli ^
|
||||
%*
|
||||
|
|
|
@ -8,6 +8,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.plugins.PluginCli \
|
||||
"$@"
|
||||
|
|
|
@ -10,6 +10,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.plugins.PluginCli ^
|
||||
%*
|
||||
|
|
|
@ -159,7 +159,7 @@ if "%JVM_SS%" == "" (
|
|||
goto:eof
|
||||
)
|
||||
|
||||
set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%"
|
||||
set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%"
|
||||
|
||||
if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual
|
||||
if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0
|
||||
|
|
|
@ -8,6 +8,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.index.translog.TranslogToolCli \
|
||||
"$@"
|
||||
|
|
|
@ -10,6 +10,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.index.translog.TranslogToolCli ^
|
||||
%*
|
||||
|
|
|
@ -51,7 +51,7 @@ if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (
|
|||
)
|
||||
|
||||
cd /d "%ES_HOME%"
|
||||
%JAVA% %ES_JAVA_OPTS% -Delasticsearch -Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!
|
||||
%JAVA% %ES_JAVA_OPTS% -Delasticsearch -Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
|
@ -373,6 +373,7 @@ This command should give you a JSON result:
|
|||
"version" : {
|
||||
"number" : "{version}",
|
||||
"build_flavor" : "oss",
|
||||
"build_type" : "zip",
|
||||
"build_hash" : "f27399d",
|
||||
"build_date" : "2016-03-30T09:51:41.449Z",
|
||||
"build_snapshot" : false,
|
||||
|
|
|
@ -142,6 +142,8 @@ The result will look similar to:
|
|||
"host": "node-0.elastic.co",
|
||||
"ip": "192.168.17",
|
||||
"version": "{version}",
|
||||
"build_flavor": "oss",
|
||||
"build_type": "zip",
|
||||
"build_hash": "587409e",
|
||||
"roles": [
|
||||
"master",
|
||||
|
@ -235,6 +237,8 @@ The result will look similar to:
|
|||
"host": "node-0.elastic.co",
|
||||
"ip": "192.168.17",
|
||||
"version": "{version}",
|
||||
"build_flavor": "oss",
|
||||
"build_type": "zip",
|
||||
"build_hash": "587409e",
|
||||
"roles": [],
|
||||
"attributes": {},
|
||||
|
|
|
@ -20,6 +20,7 @@ which should give you a response something like this:
|
|||
"version" : {
|
||||
"number" : "{version}",
|
||||
"build_flavor" : "oss",
|
||||
"build_type" : "zip",
|
||||
"build_hash" : "f27399d",
|
||||
"build_date" : "2016-03-30T09:51:41.449Z",
|
||||
"build_snapshot" : false,
|
||||
|
|
|
@ -72,13 +72,51 @@ public class Build {
|
|||
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
||||
DEB("deb"),
|
||||
RPM("rpm"),
|
||||
TAR("tar"),
|
||||
ZIP("zip"),
|
||||
UNKNOWN("unknown");
|
||||
|
||||
final String displayName;
|
||||
|
||||
public String displayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
Type(final String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public static Type fromDisplayName(final String displayName) {
|
||||
switch (displayName) {
|
||||
case "deb":
|
||||
return Type.DEB;
|
||||
case "rpm":
|
||||
return Type.RPM;
|
||||
case "tar":
|
||||
return Type.TAR;
|
||||
case "zip":
|
||||
return Type.ZIP;
|
||||
case "unknown":
|
||||
return Type.UNKNOWN;
|
||||
default:
|
||||
throw new IllegalStateException("unexpected distribution type [" + displayName + "]; your distribution is broken");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
final Flavor flavor;
|
||||
final Type type;
|
||||
final String shortHash;
|
||||
final String date;
|
||||
final boolean isSnapshot;
|
||||
|
||||
flavor = Flavor.fromDisplayName(System.getProperty("es.distribution.flavor", "unknown"));
|
||||
type = Type.fromDisplayName(System.getProperty("es.distribution.type", "unknown"));
|
||||
|
||||
final String esPrefix = "elasticsearch-" + Version.CURRENT;
|
||||
final URL url = getElasticsearchCodeSourceLocation();
|
||||
|
@ -118,7 +156,7 @@ public class Build {
|
|||
"Stopping Elasticsearch now so it doesn't run in subtly broken ways. This is likely a build bug.");
|
||||
}
|
||||
|
||||
CURRENT = new Build(flavor, shortHash, date, isSnapshot);
|
||||
CURRENT = new Build(flavor, type, shortHash, date, isSnapshot);
|
||||
}
|
||||
|
||||
private final boolean isSnapshot;
|
||||
|
@ -134,11 +172,13 @@ public class Build {
|
|||
}
|
||||
|
||||
private final Flavor flavor;
|
||||
private final Type type;
|
||||
private final String shortHash;
|
||||
private final String date;
|
||||
|
||||
public Build(Flavor flavor, String shortHash, String date, boolean isSnapshot) {
|
||||
public Build(final Flavor flavor, final Type type, final String shortHash, final String date, boolean isSnapshot) {
|
||||
this.flavor = flavor;
|
||||
this.type = type;
|
||||
this.shortHash = shortHash;
|
||||
this.date = date;
|
||||
this.isSnapshot = isSnapshot;
|
||||
|
@ -154,21 +194,30 @@ public class Build {
|
|||
|
||||
public static Build readBuild(StreamInput in) throws IOException {
|
||||
final Flavor flavor;
|
||||
final Type type;
|
||||
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
|
||||
flavor = Flavor.fromDisplayName(in.readString());
|
||||
} else {
|
||||
flavor = Flavor.OSS;
|
||||
}
|
||||
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
|
||||
type = Type.fromDisplayName(in.readString());
|
||||
} else {
|
||||
type = Type.UNKNOWN;
|
||||
}
|
||||
String hash = in.readString();
|
||||
String date = in.readString();
|
||||
boolean snapshot = in.readBoolean();
|
||||
return new Build(flavor, hash, date, snapshot);
|
||||
return new Build(flavor, type, hash, date, snapshot);
|
||||
}
|
||||
|
||||
public static void writeBuild(Build build, StreamOutput out) throws IOException {
|
||||
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
|
||||
out.writeString(build.flavor().displayName());
|
||||
}
|
||||
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
|
||||
out.writeString(build.type().displayName());
|
||||
}
|
||||
out.writeString(build.shortHash());
|
||||
out.writeString(build.date());
|
||||
out.writeBoolean(build.isSnapshot());
|
||||
|
@ -178,13 +227,17 @@ public class Build {
|
|||
return flavor;
|
||||
}
|
||||
|
||||
public Type type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isSnapshot() {
|
||||
return isSnapshot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + flavor.displayName() + "][" + shortHash + "][" + date + "]";
|
||||
return "[" + flavor.displayName() + "][" + type.displayName + "][" + shortHash + "][" + date + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -202,6 +255,10 @@ public class Build {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!type.equals(build.type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isSnapshot != build.isSnapshot) {
|
||||
return false;
|
||||
}
|
||||
|
@ -214,7 +271,7 @@ public class Build {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(flavor, isSnapshot, shortHash, date);
|
||||
return Objects.hash(flavor, type, isSnapshot, shortHash, date);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.lang.reflect.Modifier;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Version implements Comparable<Version>, ToXContentFragment {
|
||||
/*
|
||||
|
@ -502,8 +503,16 @@ public class Version implements Comparable<Version>, ToXContentFragment {
|
|||
|
||||
@SuppressForbidden(reason = "System.out.*")
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Version: " + Version.CURRENT + ", Build: " + Build.CURRENT.shortHash() + "/" + Build.CURRENT.date() + ", JVM: "
|
||||
+ JvmInfo.jvmInfo().version());
|
||||
final String versionOutput = String.format(
|
||||
Locale.ROOT,
|
||||
"Version: %s, Build: %s/%s/%s/%s, JVM: %s",
|
||||
Version.displayVersion(Version.CURRENT, Build.CURRENT.isSnapshot()),
|
||||
Build.CURRENT.flavor().displayName(),
|
||||
Build.CURRENT.type().displayName(),
|
||||
Build.CURRENT.shortHash(),
|
||||
Build.CURRENT.date(),
|
||||
JvmInfo.jvmInfo().version());
|
||||
System.out.println(versionOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,6 +66,8 @@ public class NodesInfoResponse extends BaseNodesResponse<NodeInfo> implements To
|
|||
builder.field("ip", nodeInfo.getNode().getHostAddress());
|
||||
|
||||
builder.field("version", nodeInfo.getVersion());
|
||||
builder.field("build_flavor", nodeInfo.getBuild().flavor().displayName());
|
||||
builder.field("build_type", nodeInfo.getBuild().type().displayName());
|
||||
builder.field("build_hash", nodeInfo.getBuild().shortHash());
|
||||
if (nodeInfo.getTotalIndexingBuffer() != null) {
|
||||
builder.humanReadableField("total_indexing_buffer", "total_indexing_buffer_in_bytes", nodeInfo.getTotalIndexingBuffer());
|
||||
|
|
|
@ -108,6 +108,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|||
builder.startObject("version")
|
||||
.field("number", version.toString())
|
||||
.field("build_flavor", build.flavor().displayName())
|
||||
.field("build_type", build.type().displayName())
|
||||
.field("build_hash", build.shortHash())
|
||||
.field("build_date", build.date())
|
||||
.field("build_snapshot", build.isSnapshot())
|
||||
|
@ -130,9 +131,11 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
|
|||
PARSER.declareString((response, value) -> {}, new ParseField("tagline"));
|
||||
PARSER.declareObject((response, value) -> {
|
||||
final String buildFlavor = (String) value.get("build_flavor");
|
||||
final String buildType = (String) value.get("build_type");
|
||||
response.build =
|
||||
new Build(
|
||||
buildFlavor == null ? Build.Flavor.UNKNOWN : Build.Flavor.fromDisplayName(buildFlavor),
|
||||
buildType == null ? Build.Type.UNKNOWN : Build.Type.fromDisplayName(buildType),
|
||||
(String) value.get("build_hash"),
|
||||
(String) value.get("build_date"),
|
||||
(boolean) value.get("build_snapshot"));
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.io.IOException;
|
|||
import java.nio.file.Path;
|
||||
import java.security.Permission;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This class starts elasticsearch.
|
||||
|
@ -98,9 +99,16 @@ class Elasticsearch extends EnvironmentAwareCommand {
|
|||
throw new UserException(ExitCodes.USAGE, "Positional arguments not allowed, found " + options.nonOptionArguments());
|
||||
}
|
||||
if (options.has(versionOption)) {
|
||||
terminal.println("Version: " + Version.displayVersion(Version.CURRENT, Build.CURRENT.isSnapshot())
|
||||
+ ", Build: " + Build.CURRENT.shortHash() + "/" + Build.CURRENT.date()
|
||||
+ ", JVM: " + JvmInfo.jvmInfo().version());
|
||||
final String versionOutput = String.format(
|
||||
Locale.ROOT,
|
||||
"Version: %s, Build: %s/%s/%s/%s, JVM: %s",
|
||||
Version.displayVersion(Version.CURRENT, Build.CURRENT.isSnapshot()),
|
||||
Build.CURRENT.flavor().displayName(),
|
||||
Build.CURRENT.type().displayName(),
|
||||
Build.CURRENT.shortHash(),
|
||||
Build.CURRENT.date(),
|
||||
JvmInfo.jvmInfo().version());
|
||||
terminal.println(versionOutput);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -284,10 +284,11 @@ public class Node implements Closeable {
|
|||
|
||||
final JvmInfo jvmInfo = JvmInfo.jvmInfo();
|
||||
logger.info(
|
||||
"version[{}], pid[{}], build[{}/{}/{}], OS[{}/{}/{}], JVM[{}/{}/{}/{}]",
|
||||
"version[{}], pid[{}], build[{}/{}/{}/{}], OS[{}/{}/{}], JVM[{}/{}/{}/{}]",
|
||||
Version.displayVersion(Version.CURRENT, Build.CURRENT.isSnapshot()),
|
||||
jvmInfo.pid(),
|
||||
Build.CURRENT.flavor().displayName(),
|
||||
Build.CURRENT.type().displayName(),
|
||||
Build.CURRENT.shortHash(),
|
||||
Build.CURRENT.date(),
|
||||
Constants.OS_NAME,
|
||||
|
|
|
@ -123,6 +123,8 @@ public class RestNodesAction extends AbstractCatAction {
|
|||
table.addCell("http_address", "default:false;alias:http;desc:bound http address");
|
||||
|
||||
table.addCell("version", "default:false;alias:v;desc:es version");
|
||||
table.addCell("flavor", "default:false;alias:f;desc:es distribution flavor");
|
||||
table.addCell("type", "default:false;alias:t;desc:es distribution type");
|
||||
table.addCell("build", "default:false;alias:b;desc:es build hash");
|
||||
table.addCell("jdk", "default:false;alias:j;desc:jdk version");
|
||||
table.addCell("disk.total", "default:false;alias:dt,diskTotal;text-align:right;desc:total disk space");
|
||||
|
@ -271,6 +273,8 @@ public class RestNodesAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
table.addCell(node.getVersion().toString());
|
||||
table.addCell(info == null ? null : info.getBuild().flavor().displayName());
|
||||
table.addCell(info == null ? null : info.getBuild().type().displayName());
|
||||
table.addCell(info == null ? null : info.getBuild().shortHash());
|
||||
table.addCell(jvmInfo == null ? null : jvmInfo.version());
|
||||
|
||||
|
|
|
@ -44,22 +44,29 @@ public class BuildTests extends ESTestCase {
|
|||
public void testEqualsAndHashCode() {
|
||||
Build build = Build.CURRENT;
|
||||
|
||||
Build another = new Build(build.flavor(), build.shortHash(), build.date(), build.isSnapshot());
|
||||
Build another = new Build(build.flavor(), build.type(), build.shortHash(), build.date(), build.isSnapshot());
|
||||
assertEquals(build, another);
|
||||
assertEquals(build.hashCode(), another.hashCode());
|
||||
|
||||
final Set<Build.Flavor> otherFlavors =
|
||||
Arrays.stream(Build.Flavor.values()).filter(f -> !f.equals(build.flavor())).collect(Collectors.toSet());
|
||||
Build differentFlavor = new Build(randomFrom(otherFlavors), build.shortHash(), build.date(), build.isSnapshot());
|
||||
final Build.Flavor otherFlavor = randomFrom(otherFlavors);
|
||||
Build differentFlavor = new Build(otherFlavor, build.type(), build.shortHash(), build.date(), build.isSnapshot());
|
||||
assertNotEquals(build, differentFlavor);
|
||||
|
||||
Build differentHash = new Build(build.flavor(), randomAlphaOfLengthBetween(3, 10), build.date(), build.isSnapshot());
|
||||
final Set<Build.Type> otherTypes =
|
||||
Arrays.stream(Build.Type.values()).filter(f -> !f.equals(build.type())).collect(Collectors.toSet());
|
||||
final Build.Type otherType = randomFrom(otherTypes);
|
||||
Build differentType = new Build(build.flavor(), otherType, build.shortHash(), build.date(), build.isSnapshot());
|
||||
assertNotEquals(build, differentType);
|
||||
|
||||
Build differentHash = new Build(build.flavor(), build.type(), randomAlphaOfLengthBetween(3, 10), build.date(), build.isSnapshot());
|
||||
assertNotEquals(build, differentHash);
|
||||
|
||||
Build differentDate = new Build(build.flavor(), build.shortHash(), "1970-01-01", build.isSnapshot());
|
||||
Build differentDate = new Build(build.flavor(), build.type(), build.shortHash(), "1970-01-01", build.isSnapshot());
|
||||
assertNotEquals(build, differentDate);
|
||||
|
||||
Build differentSnapshot = new Build(build.flavor(), build.shortHash(), build.date(), !build.isSnapshot());
|
||||
Build differentSnapshot = new Build(build.flavor(), build.type(), build.shortHash(), build.date(), !build.isSnapshot());
|
||||
assertNotEquals(build, differentSnapshot);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ public class MainResponseTests extends AbstractStreamableXContentTestCase<MainRe
|
|||
String clusterUuid = randomAlphaOfLength(10);
|
||||
ClusterName clusterName = new ClusterName(randomAlphaOfLength(10));
|
||||
String nodeName = randomAlphaOfLength(10);
|
||||
Build build =
|
||||
new Build(Build.Flavor.UNKNOWN, randomAlphaOfLength(8), new Date(randomNonNegativeLong()).toString(), randomBoolean());
|
||||
final String date = new Date(randomNonNegativeLong()).toString();
|
||||
Build build = new Build(Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, randomAlphaOfLength(8), date, randomBoolean());
|
||||
Version version = VersionUtils.randomVersion(random());
|
||||
return new MainResponse(nodeName, version, clusterName, clusterUuid , build);
|
||||
}
|
||||
|
@ -58,7 +58,8 @@ public class MainResponseTests extends AbstractStreamableXContentTestCase<MainRe
|
|||
|
||||
public void testToXContent() throws IOException {
|
||||
String clusterUUID = randomAlphaOfLengthBetween(10, 20);
|
||||
Build build = new Build(Build.CURRENT.flavor(), Build.CURRENT.shortHash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot());
|
||||
final Build current = Build.CURRENT;
|
||||
Build build = new Build(current.flavor(), current.type(), current.shortHash(), current.date(), current.isSnapshot());
|
||||
Version version = Version.CURRENT;
|
||||
MainResponse response = new MainResponse("nodeName", version, new ClusterName("clusterName"), clusterUUID, build);
|
||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||
|
@ -69,10 +70,11 @@ public class MainResponseTests extends AbstractStreamableXContentTestCase<MainRe
|
|||
+ "\"cluster_uuid\":\"" + clusterUUID + "\","
|
||||
+ "\"version\":{"
|
||||
+ "\"number\":\"" + version.toString() + "\","
|
||||
+ "\"build_flavor\":\"" + Build.CURRENT.flavor().displayName() + "\","
|
||||
+ "\"build_hash\":\"" + Build.CURRENT.shortHash() + "\","
|
||||
+ "\"build_date\":\"" + Build.CURRENT.date() + "\","
|
||||
+ "\"build_snapshot\":" + Build.CURRENT.isSnapshot() + ","
|
||||
+ "\"build_flavor\":\"" + current.flavor().displayName() + "\","
|
||||
+ "\"build_type\":\"" + current.type().displayName() + "\","
|
||||
+ "\"build_hash\":\"" + current.shortHash() + "\","
|
||||
+ "\"build_date\":\"" + current.date() + "\","
|
||||
+ "\"build_snapshot\":" + current.isSnapshot() + ","
|
||||
+ "\"lucene_version\":\"" + version.luceneVersion.toString() + "\","
|
||||
+ "\"minimum_wire_compatibility_version\":\"" + version.minimumCompatibilityVersion().toString() + "\","
|
||||
+ "\"minimum_index_compatibility_version\":\"" + version.minimumIndexCompatibilityVersion().toString() + "\"},"
|
||||
|
@ -96,7 +98,7 @@ public class MainResponseTests extends AbstractStreamableXContentTestCase<MainRe
|
|||
break;
|
||||
case 2:
|
||||
// toggle the snapshot flag of the original Build parameter
|
||||
build = new Build(Build.Flavor.UNKNOWN, build.shortHash(), build.date(), !build.isSnapshot());
|
||||
build = new Build(Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, build.shortHash(), build.date(), !build.isSnapshot());
|
||||
break;
|
||||
case 3:
|
||||
version = randomValueOtherThan(version, () -> VersionUtils.randomVersion(random()));
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.monitor.jvm.JvmInfo;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -65,7 +66,14 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase {
|
|||
private void runTestThatVersionIsReturned(String... args) throws Exception {
|
||||
runTestVersion(ExitCodes.OK, output -> {
|
||||
assertThat(output, containsString("Version: " + Version.displayVersion(Version.CURRENT, Build.CURRENT.isSnapshot())));
|
||||
assertThat(output, containsString("Build: " + Build.CURRENT.shortHash() + "/" + Build.CURRENT.date()));
|
||||
final String expectedBuildOutput = String.format(
|
||||
Locale.ROOT,
|
||||
"Build: %s/%s/%s/%s",
|
||||
Build.CURRENT.flavor().displayName(),
|
||||
Build.CURRENT.type().displayName(),
|
||||
Build.CURRENT.shortHash(),
|
||||
Build.CURRENT.date());
|
||||
assertThat(output, containsString(expectedBuildOutput));
|
||||
assertThat(output, containsString("JVM: " + JvmInfo.jvmInfo().version()));
|
||||
}, args);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.xpack.core.ssl.CertificateGenerateTool \
|
||||
"$@"
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-security-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.core.ssl.CertificateGenerateTool ^
|
||||
%*
|
||||
|
|
|
@ -14,6 +14,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.xpack.core.ssl.CertificateTool \
|
||||
"$@"
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-security-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.core.ssl.CertificateTool ^
|
||||
%*
|
||||
|
|
|
@ -14,6 +14,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool \
|
||||
"$@"
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-security-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool ^
|
||||
%*
|
||||
|
|
|
@ -14,6 +14,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.xpack.security.authc.saml.SamlMetadataCommand \
|
||||
"$@"
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-security-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.security.authc.saml.SamlMetadataCommand ^
|
||||
%*
|
||||
|
|
|
@ -14,6 +14,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool \
|
||||
"$@"
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-security-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool ^
|
||||
%*
|
||||
|
|
|
@ -14,6 +14,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.xpack.security.crypto.tool.SystemKeyTool \
|
||||
"$@"
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-security-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.security.crypto.tool.SystemKeyTool ^
|
||||
%*
|
||||
|
|
|
@ -14,6 +14,7 @@ exec \
|
|||
-Des.path.home="$ES_HOME" \
|
||||
-Des.path.conf="$ES_PATH_CONF" \
|
||||
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
|
||||
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
|
||||
-cp "$ES_CLASSPATH" \
|
||||
org.elasticsearch.xpack.security.authc.file.tool.UsersTool \
|
||||
"$@"
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-security-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.security.authc.file.tool.UsersTool ^
|
||||
%*
|
||||
|
|
|
@ -15,6 +15,8 @@ set CLI_JAR=%ES_HOME%/plugins/bin/*
|
|||
|
||||
%JAVA% ^
|
||||
-cp "%CLI_JAR%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
org.elasticsearch.xpack.sql.cli.Cli ^
|
||||
%*
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ call "%~dp0x-pack-watcher-env.bat" || exit /b 1
|
|||
-Des.path.home="%ES_HOME%" ^
|
||||
-Des.path.conf="%ES_PATH_CONF%" ^
|
||||
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
|
||||
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
|
||||
-cp "%ES_CLASSPATH%" ^
|
||||
org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEvalTool ^
|
||||
%*
|
||||
|
|
Loading…
Reference in New Issue