Skip to content

Commit

Permalink
Validations - add controller connection check;
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexJov committed Jan 20, 2021
1 parent d3e6c6f commit 3a11eef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
19 changes: 18 additions & 1 deletion modules/validations/controller.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
#!/bin/bash

#todo
source ./modules/common/http_check.sh # func_check_http_status

_controller_url=${1} # hostname + /controller
_user_credentials=${2} # ${username}:${password}

_proxy_details=${3}

# Check if you can connect to a controler
echo "VAL|Checking connection to controller '${_controller_url}'..."

# timeout after 10s
controllerReponse=$(curl -s --user ${_user_credentials} ${_controller_url}/rest/applications ${_proxy_details} --connect-timeout 10)

if [ "$controllerReponse" = "" ]; then
func_check_http_status 404 "Unable to connect to controller: '"$_controller_url"'. Aborting..."
fi

echo "VAL||Succesfully reached '${_controller_url}'."
7 changes: 6 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,12 @@ case $ec in
esac

## 2. contrtoller connection
#todo
./modules/validations/controller.sh "$_arg_controller_url" "$_arg_user_credentials" "$_arg_proxy_details" ; ec=$?

case $ec in
0) ;;
1) printf '%s\n' "Command exited with non-zero code"; exit 1;;
esac

## 3. application

Expand Down

0 comments on commit 3a11eef

Please sign in to comment.