fleet_login.sh #1

  • //
  • guest/
  • perforce_software/
  • sdp/
  • main/
  • test/
  • bsw/
  • fleet_login.sh
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/bin/bash
set -u

# Start state: User perforce may or may not have a valid
# ticket on all servers in the fleet. It is inteded to be called on
# bos-helix-01.
# Goal: Ensure primrary super user is logged in everywhere.

declare SDPInstance=${1:-${SDP_INSTANCE:-1}}
declare -i LoginOKCount=0
declare -i ErrorCount=0

function msg () { echo -e "$*"; }
function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount+=1; }

msg "Calling: $PWD/create_master_service_user.sh"
if $PWD/create_master_service_user.sh; then
   msg "Verified: create_master_service_user.sh reported OK."
else
   errmsg "Errors were reported by create_master_service_user.sh."
fi

for host in helix-0{1..5}; do
   msg "Logging in primary super user on host $host."
   if timeout 20s ssh -q "$host" /p4/common/bin/p4login "$SDPInstance" -v; then
      LoginOKCount+=1
   else
      errmsg "Failed to do 'p4login $SDPInstance -v' on host $host."
   fi

   msg "Logging in replication service user on host $host."
   if timeout 20s ssh -q "$host" /p4/common/bin/p4login "$SDPInstance" -v -service; then
      LoginOKCount+=1
   else
      errmsg "Failed to do 'p4login $SDPInstance -v -service' on host $host."
   fi
done

if [[ "$ErrorCount" -eq 0 ]]; then
   msg "SUCCESS: Login OK on all targeted hosts."
else
   errmsg "Logins failed on $ErrorCount hosts; OK on only $LoginOKCount hosts."
fi

exit "$ErrorCount"
# Change User Description Committed
#1 31566 C. Thomas Tyler Released SDP 2024.2.31564 (2025/05/14).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
//guest/perforce_software/sdp/dev/test/bsw/fleet_login.sh
#3 31548 C. Thomas Tyler Added call to create_master_service_user.sh in fleet_login.sh.
Added sleep delay to give service user creation bits time to pull.
#2 31541 C. Thomas Tyler Added code to do fleet-wide 'p4login -v -service' calls.
#1 31540 C. Thomas Tyler Added require test cleanup so that the SecurityCheck test
group, which messes with 'auth.id', doesn't break other
tests, including scripted tests.