Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Used set to make shell scripts more strict #3278

Merged
merged 3 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dev-tools/signoff-check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

set -e

### Script to check for signoff presents on commits

# Validate input parameters
Expand Down
2 changes: 2 additions & 0 deletions distribution/docker/docker-test-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -e

cd /usr/share/opensearch/bin/

/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/opensearch/logs/console.log
2 changes: 2 additions & 0 deletions distribution/packages/src/common/scripts/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# $1=1 : indicates an new install
# $1=2 : indicates an upgrade

set -e

err_exit() {
echo "$@" >&2
exit 1
Expand Down
2 changes: 2 additions & 0 deletions distribution/packages/src/common/systemd/systemd-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# This wrapper script allows SystemD to feed a file containing a passphrase into
# the main OpenSearch startup script

set -e

if [ -n "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE" ] ; then
exec /usr/share/opensearch/bin/opensearch "$@" < "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE"
else
Expand Down
2 changes: 2 additions & 0 deletions distribution/packages/src/deb/init.d/opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Description: Starts opensearch using start-stop-daemon
### END INIT INFO

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=opensearch
DESC="OpenSearch Server"
Expand Down
2 changes: 2 additions & 0 deletions distribution/packages/src/rpm/init.d/opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# Description: OpenSearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
### END INIT INFO

set -e

#
# init.d / servicectl compatibility (openSUSE)
#
Expand Down
2 changes: 2 additions & 0 deletions distribution/src/bin/opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#
# OPENSEARCH_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/opensearch

set -e

source "`dirname "$0"`"/opensearch-env

CHECK_KEYSTORE=true
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/opensearch-cli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e -o pipefail
set -e

source "`dirname "$0"`"/opensearch-env

Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/opensearch-env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e -o pipefail
set -e

CDPATH=""

Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/opensearch-env-from-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e -o pipefail
set -e

# Allow environment variables to be set by creating a file with the
# contents, and setting an environment variable with the suffix _FILE to
Expand Down
2 changes: 2 additions & 0 deletions distribution/src/bin/opensearch-keystore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e

OPENSEARCH_MAIN_CLASS=org.opensearch.common.settings.KeyStoreCli \
OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/keystore-cli \
"`dirname "$0"`"/opensearch-cli \
Expand Down
1 change: 1 addition & 0 deletions distribution/src/bin/opensearch-node
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e

OPENSEARCH_MAIN_CLASS=org.opensearch.cluster.coordination.NodeToolCli \
"`dirname "$0"`"/opensearch-cli \
Expand Down
2 changes: 2 additions & 0 deletions distribution/src/bin/opensearch-plugin
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e

OPENSEARCH_MAIN_CLASS=org.opensearch.plugins.PluginCli \
OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli \
"`dirname "$0"`"/opensearch-cli \
Expand Down
2 changes: 2 additions & 0 deletions distribution/src/bin/opensearch-shard
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e

OPENSEARCH_MAIN_CLASS=org.opensearch.index.shard.ShardToolCli \
"`dirname "$0"`"/opensearch-cli \
"$@"
1 change: 1 addition & 0 deletions distribution/src/bin/opensearch-upgrade
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e

OPENSEARCH_MAIN_CLASS=org.opensearch.upgrade.UpgradeCli \
OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/upgrade-cli \
Expand Down
2 changes: 2 additions & 0 deletions qa/remote-clusters/docker-test-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -e

cd /usr/share/opensearch/bin/
./opensearch-users useradd rest_user -p test-password -r superuser || true
echo "testnode" > /tmp/password
Expand Down