mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 15:17:30 -04:00
Introduce unified entrypoint for CLI scripts (#85821)
CLI scripts have a common infrastructure in that they call to the shared elasticsearch-cli shell script which launches them with the appropriate java command line. However, each underlying Java class must implement its own main method. This commit introduces a single main method to be shared by CLIs. The new CliToolLauncher takes in system properties to determine which tool is being run, and a new CliToolProvider SPI allows defining and finding the named tools. relates #85758 Co-authored-by: William Brafford <william.brafford@elastic.co>
This commit is contained in:
parent
7dee198ac7
commit
1d4534f848
99 changed files with 802 additions and 344 deletions
|
@ -59,17 +59,15 @@ if [ "x$IS_UPGRADE" != "xtrue" ]; then
|
|||
# Don't exit immediately on error, we want to hopefully print some helpful banners
|
||||
set +e
|
||||
# Attempt to auto-configure security, this seems to be an installation
|
||||
if ES_MAIN_CLASS=org.elasticsearch.xpack.security.cli.AutoConfigureNode \
|
||||
ES_ADDITIONAL_SOURCES="x-pack-env;x-pack-security-env" \
|
||||
ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli \
|
||||
if CLI_NAME="auto-configure-node" \
|
||||
CLI_LIBS="modules/x-pack-core,modules/x-pack-security,lib/tools/security-cli" \
|
||||
/usr/share/elasticsearch/bin/elasticsearch-cli <<< ""; then
|
||||
# Above command runs as root and TLS keystores are created group-owned by root. It's simple to correct the ownership here
|
||||
chown root:elasticsearch "${ES_PATH_CONF}"/certs/http.p12
|
||||
chown root:elasticsearch "${ES_PATH_CONF}"/certs/http_ca.crt
|
||||
chown root:elasticsearch "${ES_PATH_CONF}"/certs/transport.p12
|
||||
if INITIAL_PASSWORD=$(ES_MAIN_CLASS=org.elasticsearch.xpack.security.enrollment.tool.AutoConfigGenerateElasticPasswordHash \
|
||||
ES_ADDITIONAL_SOURCES="x-pack-env;x-pack-security-env" \
|
||||
ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/security-cli \
|
||||
if INITIAL_PASSWORD=$(CLI_NAME=auto-config-gen-passwd \
|
||||
CLI_LIBS="modules/x-pack-core,modules/x-pack-security,lib/tools/security-cli" \
|
||||
/usr/share/elasticsearch/bin/elasticsearch-cli); then
|
||||
echo "--------------------------- Security autoconfiguration information ------------------------------"
|
||||
echo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue