Skip to content

Commit

Permalink
Fixed syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Owais Kazi <[email protected]>
  • Loading branch information
owaiskazi19 committed Sep 8, 2022
1 parent 454a381 commit 1ac1a28
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/code-hygiene.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:

- name: Linelint
uses: fernandrone/[email protected]
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: "*/gradlew"
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: ./gradlew
11 changes: 6 additions & 5 deletions client/sniffer/src/test/resources/create_test_nodes_info.bash
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ function do_version() {

tar xf ../opensearch-min-${version}-linux-x64.tar.gz
local http_port=9200
local cluster_manager initial_cluster_manager_nodes data
for node in ${nodes}; do
mkdir ${node}
cp -r opensearch-${version}/* ${node}
local cluster_manager=$([[ "$node" =~ ^m.* ]] && echo 'cluster_manager,' || echo '')
cluster_manager=$([[ "$node" =~ ^m.* ]] && echo 'cluster_manager,' || echo '')
# 'cluster_manager' role is add in version 2.x and above, use 'master' role in 1.x
cluster_manager=$([[ ! "$cluster_manager" == '' && ${version} =~ ^1\. ]] && echo 'master,' || echo ${cluster_manager})
local data=$([[ "$node" =~ ^d.* ]] && echo 'data,' || echo '')
data=$([[ "$node" =~ ^d.* ]] && echo 'data,' || echo '')
# m2 is always cluster_manager and data for these test just so we have a node like that
data=$([[ "$node" == 'm2' ]] && echo 'data,' || echo ${data})
# setting name 'cluster.initial_cluster_manager_nodes' is add in version 2.x and above
local initial_cluster_manager_nodes=$([[ ${version} =~ ^1\. ]] && echo 'initial_master_nodes' || echo 'initial_cluster_manager_nodes')
initial_cluster_manager_nodes=$([[ ${version} =~ ^1\. ]] && echo 'initial_master_nodes' || echo 'initial_cluster_manager_nodes')
local transport_port=$((http_port+100))

cat >> ${node}/config/opensearch.yml << __OPENSEARCH_YML
Expand Down Expand Up @@ -79,7 +80,7 @@ __OPENSEARCH_YML
done

echo "waiting for all nodes to join"
until [ $(echo ${nodes} | wc -w) -eq $(curl -s localhost:9200/_cat/nodes | wc -l) ]; do
until [ "$(echo ${nodes} | wc -w)" -eq "$(curl -s localhost:9200/_cat/nodes | wc -l)" ]; do
sleep .25
done

Expand All @@ -90,7 +91,7 @@ __OPENSEARCH_YML

for node in ${nodes}; do
echo "stopping ${version}/${node}..."
kill $(cat ${node}/pidfile)
kill "$(cat ${node}/pidfile)"
done

popd >> /dev/null
Expand Down
7 changes: 4 additions & 3 deletions distribution/packages/src/deb/init.d/opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NAME=opensearch
DESC="OpenSearch Server"
DEFAULT=/etc/default/$NAME

if [ `id -u` -ne 0 ]; then
if [ "`id -u`" -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
Expand Down Expand Up @@ -59,6 +59,7 @@ PID_DIR="/var/run/opensearch"

# overwrite settings from default file
if [ -f "$DEFAULT" ]; then
# shellcheck source=/dev/null
. "$DEFAULT"
fi

Expand Down Expand Up @@ -105,7 +106,7 @@ case "$1" in
ulimit -l $MAX_LOCKED_MEMORY
fi

if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt $(cat /proc/sys/vm/max_map_count) ]; then
if [ -n "$MAX_MAP_COUNT" ] && [ -f /proc/sys/vm/max_map_count ] && [ "$MAX_MAP_COUNT" -gt "$(cat /proc/sys/vm/max_map_count)" ]; then
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
fi

Expand All @@ -116,7 +117,7 @@ case "$1" in
i=0
timeout=10
# Wait for the process to be properly started before exiting
until { kill -0 `cat "$PID_FILE"`; } >/dev/null 2>&1
until { kill -0 "`cat "$PID_FILE"`"; } >/dev/null 2>&1
do
sleep 1
i=$(($i + 1))
Expand Down

0 comments on commit 1ac1a28

Please sign in to comment.