Skip to content

Commit

Permalink
[Backport 2.x] Updates integTest behavior to accept the version and s…
Browse files Browse the repository at this point in the history
…et the password accordingly and removes admin:admin reference from the Handbook (#1327)

* Remove references to admin:admin (#1298)

* Remove references to admin:admin

Signed-off-by: Derek Ho <dxho@amazon.com>

* Try to pass in initial admin password via env variable

Signed-off-by: Derek Ho <dxho@amazon.com>

* Try using the env variable

Signed-off-by: Derek Ho <dxho@amazon.com>

* Revert file deletion and add logic for integration tests

Signed-off-by: Derek Ho <dxho@amazon.com>

* fix env variable

Signed-off-by: Derek Ho <dxho@amazon.com>

* Update logic to be the same across all repos

Signed-off-by: Derek Ho <dxho@amazon.com>

* Keep old logic

Signed-off-by: Derek Ho <dxho@amazon.com>

* Change variable name

Signed-off-by: Derek Ho <dxho@amazon.com>

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
(cherry picked from commit 3ea239b)
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Updates integTest behavior to accept the version and set the password accordingly

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
(cherry picked from commit d703887)

---------

Signed-off-by: Derek Ho <dxho@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Co-authored-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
DarshitChanpura and derek-ho committed Feb 12, 2024
1 parent 7e2902c commit a639ca9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion HANDBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ plugins.security.nodes_dn_dynamic_config_enabled: true
Allow connections from follower cluster on the leader as follows
```bash
curl -k -u admin:admin -XPUT "https://${LEADER}/_plugins/_security/api/nodesdn/follower" \
curl -k -u admin:<admin password> -XPUT "https://${LEADER}/_plugins/_security/api/nodesdn/follower" \
-H 'Content-type: application/json' \
-d'{"nodes_dn": ["CN=follower.example.com"]}'
```
Expand Down
15 changes: 13 additions & 2 deletions scripts/integtest.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ while getopts ":h:b:p:t:e:s:c:v:" arg; do
CREDENTIAL=$OPTARG
;;
v)
# Do nothing as we're not consuming this param.
OPENSEARCH_VERSION=$OPTARG
;;
:)
echo "-${OPTARG} requires an argument"
Expand All @@ -70,9 +70,20 @@ then
SECURITY_ENABLED="true"
fi

OPENSEARCH_REQUIRED_VERSION="2.12.0"

if [ -z "$CREDENTIAL" ]
then
CREDENTIAL="admin:admin"
# Starting in 2.12.0, security demo configuration script requires an initial admin password
# Pick the minimum of two versions
VERSION_TO_COMPARE=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
# Check if the compared version is not equal to the required version.
# If it is not equal, it means the current version is older.
if [ "$VERSION_TO_COMPARE" != "$OPENSEARCH_REQUIRED_VERSION" ]; then
CREDENTIAL="admin:admin"
else
CREDENTIAL="admin:myStrongPassword123!"
fi
fi

USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'`
Expand Down

0 comments on commit a639ca9

Please sign in to comment.