Skip to content

hard coded values for check_healthcheck_ok function #224

@pierrepgithub

Description

@pierrepgithub

The below function has hard coded values for the OHS instance name which results in errors on this step during OAM deployment

check_healthcheck_ok()
{
   ST=$(date +%s)
   print_msg "Checking Health-check is not blocked"

   printf "\n\t\t\t$OHS_HOST1 - "
   blocked_ip=$( $SSH ${OHS_USER}@$OHS_HOST1 grep health-check.html  $OHS_DOMAIN/servers/ohs?/logs/access_log | grep 403 | awk '{ print $1 }' | tail -1 )
   if [ "$blocked_ip" = "" ]
   then
     echo "Success"
   else
     printf "Blocked by IP Address: $blocked_ip - Fixing - "
     $SSH ${OHS_USER}@$OHS_HOST1 -C sed -i \"/    require host/a "\\    require ip $blocked_ip"\" $OHS_DOMAIN/config/fmwconfig/components/OHS/ohs?/webgate.conf
     print_status $?
     printf "\t\t\tRestarting OHS $OHS_HOST1 - "
     $SSH ${OHS_USER}@$OHS_HOST1 "$OHS_DOMAIN/bin/restartComponent.sh $OHS1_NAME" > $LOGDIR/restart_$OHS_HOST1.log 2>&1
     print_status $? $LOGDIR/restart_$OHS_HOST1.log
   fi

   if [ ! "$OHS_HOST2" = "" ]
   then
     printf "\n\t\t\t$OHS_HOST2 - "
     blocked_ip=$( $SSH ${OHS_USER}@$OHS_HOST2 grep health-check.html  $OHS_DOMAIN/servers/ohs?/logs/access_log | grep 403 | awk '{ print $1 }' | tail -1 )
     if [ "$blocked_ip" = "" ]
     then
       echo "Success"
     else
       printf "Blocked by IP Address: $blocked_ip - Fixing - "
       $SSH ${OHS_USER}@$OHS_HOST2 -C sed -i \"/    require host/a "\\    require ip $blocked_ip"\" $OHS_DOMAIN/config/fmwconfig/components/OHS/ohs?/webgate.conf
       print_status $?
       printf "\t\t\tRestarting OHS $OHS_HOST2 - "
       $SSH ${OHS_USER}@$OHS_HOST2 "$OHS_DOMAIN/bin/restartComponent.sh $OHS2_NAME" > $LOGDIR/restart_$OHS_HOST2.log 2>&1
       print_status $? $LOGDIR/restart_$OHS_HOST2.log
     fi
   fi
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions