Use bash in packaging heredocs (elastic/x-pack-elasticsearch#4145)

In some places in the packaging tests we use heredocs to run some
scripts, for example, under the root user. However, we were running
these heredocs under sh instead of bash. This is confusing since we use
bash everywhere and we end up with syntax in the herdocs that expects
bash but will not necessarily be run under bash. For example, one
circumstance where this arises is the bash syntax [[. This leads to
packaging test failures on some systems (e.g., the debian-8 box) that
are solely due to this sh/bash distinction. We should really be using
bash everywhere, it is the shell that we settled on for all of our
scripts everywhere awhile ago and then we can avoid this confusion. This
commit replaces the usage of sh in the X-Pack packaging tests with bash.

Original commit: elastic/x-pack-elasticsearch@7555bb32c8
This commit is contained in:
Jason Tedor 2018-03-18 13:06:11 -04:00 committed by GitHub
parent 7ea79c88ab
commit 83aae92353
3 changed files with 8 additions and 8 deletions

View File

@ -49,7 +49,7 @@ fi
sudo rm -f /tmp/bootstrap.password
fi
run sudo -E -u $ESPLUGIN_COMMAND_USER sh <<"NEW_PASS"
run sudo -E -u $ESPLUGIN_COMMAND_USER bash <<"NEW_PASS"
if [[ ! -f $ESCONFIG/elasticsearch.keystore ]]; then
$ESHOME/bin/elasticsearch-keystore create
fi
@ -65,7 +65,7 @@ NEW_PASS
}
@test "[$GROUP] test bootstrap.password is in setting list" {
run sudo -E -u $ESPLUGIN_COMMAND_USER sh <<"NODE_SETTINGS"
run sudo -E -u $ESPLUGIN_COMMAND_USER bash <<"NODE_SETTINGS"
cat >> $ESCONFIG/elasticsearch.yml <<- EOF
network.host: 127.0.0.1
http.port: 9200
@ -92,7 +92,7 @@ NODE_SETTINGS
sudo rm -f /tmp/setup-passwords-output-with-bootstrap
fi
run sudo -E -u $ESPLUGIN_COMMAND_USER sh <<"SETUP_OK"
run sudo -E -u $ESPLUGIN_COMMAND_USER bash <<"SETUP_OK"
echo 'y' | $ESHOME/bin/x-pack/setup-passwords auto
SETUP_OK
echo "$output" > /tmp/setup-passwords-output-with-bootstrap

View File

@ -152,7 +152,7 @@ start_node_using_package() {
# The alternative would be to start the master node, use setup-passwords
# and restart the node once ssl/tls is configured. Or use setup-passwords over
# HTTPS with the right cacerts imported into a Java keystore.
run sudo -E -u $MASTER_USER sh <<"NEW_PASS"
run sudo -E -u $MASTER_USER bash <<"NEW_PASS"
if [[ ! -f $ESCONFIG/elasticsearch.keystore ]]; then
$ESHOME/bin/elasticsearch-keystore create
fi
@ -166,7 +166,7 @@ NEW_PASS
}
@test "[$GROUP] create instances file" {
run sudo -E -u $MASTER_USER sh <<"CREATE_INSTANCES_FILE"
run sudo -E -u $MASTER_USER bash <<"CREATE_INSTANCES_FILE"
cat > /tmp/instances.yml <<- EOF
instances:
- name: "node-master"
@ -233,7 +233,7 @@ CREATE_INSTANCES_FILE
export ESHOME="$MASTER_HOME"
export_elasticsearch_paths
run sudo -E -u $MASTER_USER sh <<"MASTER_SETTINGS"
run sudo -E -u $MASTER_USER bash <<"MASTER_SETTINGS"
cat >> $ESCONFIG/elasticsearch.yml <<- EOF
node.name: "node-master"
node.master: true
@ -316,7 +316,7 @@ MASTER_SETTINGS
export ESHOME="$DATA_HOME"
export_elasticsearch_paths
run sudo -E -u $DATA_USER sh <<"DATA_SETTINGS"
run sudo -E -u $DATA_USER bash <<"DATA_SETTINGS"
cat >> $ESCONFIG/elasticsearch.yml <<- EOF
node.name: "node-data"
node.master: false

View File

@ -49,7 +49,7 @@ fi
run_elasticsearch_service 0
wait_for_xpack
run sudo -E -u $ESPLUGIN_COMMAND_USER sh <<"SETUP_AUTO"
run sudo -E -u $ESPLUGIN_COMMAND_USER bash <<"SETUP_AUTO"
echo 'y' | $ESHOME/bin/x-pack/setup-passwords auto
SETUP_AUTO
echo "$output" > /tmp/setup-passwords-output