Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hard coded values for check_healthcheck_ok function #224

Open
pierrepgithub opened this issue Oct 30, 2024 · 1 comment
Open

hard coded values for check_healthcheck_ok function #224

pierrepgithub opened this issue Oct 30, 2024 · 1 comment

Comments

@pierrepgithub
Copy link

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
}
@solanki-chetan
Copy link
Member

I see that every where $OHS_HOST2 or $OHS_HOST1 etc. can you please point out a particular instance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants