3
APACHE=$(juju status --format=yaml apache2 2>&1 | sed -nr '/^ {8}public-address/s/.*://p')
4
TEAMS=$(juju config apache-openid --format=json |jq -r '.settings .authorized_teams .value'| sed 's/ /\n/g')
6
if [ -z "${APACHE}" ]; then
7
echo "No apache2 instances"
11
for UNIT in ${APACHE}; do
13
echo "Calling unit to ensure it returns SSO redirect"
14
echo "curl -sik \"https://${UNIT}\" |egrep 'location:.+openid/\+login'"
15
curl -sik "https://${UNIT}" |egrep 'location:.+openid/\+login'
17
echo "####################"
18
echo "# E2E Check Failed #"
19
echo "####################"
23
echo "Checking unit's /etc/apache2/openid/teams.txt matches authorized_teams setting"
24
AUTHORIZED_TEAMS=$(juju run --application apache2 'sudo cat /etc/apache2/openid/teams.txt' --format=json |jq -r '.[] .Stdout'|sed '/^$/d')
25
if [ "${TEAMS}" != "${AUTHORIZED_TEAMS}" ]; then
26
echo "####################"
27
echo "# E2E Check Failed #"
28
echo "####################"
33
# If we are here it means no checks failed
34
echo "####################"
35
echo "# E2E Check Passed #"
36
echo "####################"