#!/bin/bash #============================================================================== # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce_software-hms/view/main/LICENSE #------------------------------------------------------------------------------ set -u #============================================================================== # Functions function msg () { echo -e "$*"; } function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount+=1; } function bail () { errmsg "${1:-Unknown Error}"; exit "${2:-1}"; } #============================================================================== # Declarations and Environment declare -i ErrorCount=0 declare SDPEnvFile= declare HMSTestEnvFile="$PWD/env.sh" declare ThisScript="${0##*/}" declare Version=1.1.2 declare ThisUser= ThisUser=$(whoami) msg "\\nStarting $ThisScript v$Version as $ThisUser@${HOSTNAME%%.*} on $(date)." [[ ${BASH_VERSINFO[0]} -lt 4 ]] && \ bail "${0##*/} requires bash version 4.x+; current bash version is $BASH_VERSION." [[ -r "$HMSTestEnvFile" ]] || bail "Missing HMS test environment file: $HMSTestEnvFile" source "$HMSTestEnvFile" ||\ errmsg "Failed to load SDP environment file: $HMSTestEnvFile" SDPEnvFile="${SDP_ENV:-/p4/common/bin/p4_vars}" [[ -r "$SDPEnvFile" ]] || bail "Missing SDP environment file: $SDPEnvFile" source "$SDPEnvFile" hms ||\ errmsg "Failed to load HMS test environment file: $HMSTestEnvFile" # Override P4TMP to work outside full SDP runtime environment. export P4TMP="/tmp/hms.test" [[ -d "$P4TMP" ]] || mkdir -p "$P4TMP" declare BASH_LIBS=$P4U_ENV BASH_LIBS+=" ${HMS_LIB}/hms_upgrade.sh" for bash_lib in $BASH_LIBS; do # shellcheck disable=SC1090 source "$bash_lib" ||\ errmsg "Failed to load bash lib [$bash_lib]. Aborting." done [[ "$ErrorCount" -eq 0 ]] || bail "Aborting due to lib load failures." msg "Starting tests." VERBOSITY=6 declare Instance=1 source /p4/common/bin/p4_vars "$Instance" source /p4/common/lib/libp4u.sh source /p4/common/lib/libcore.sh export VERBOSITY=5 declare P4="$P4BIN -p $P4PORT" #------------------------------------------------------------------------------ # Simluate Declarations made in 'hms' script.. # ServerIDs and their P4TARGET values. declare -A ServerTargets # ServerIDs and their hosts values. declare -A ServerHosts # ServerIDs and their Type values (server, proxy, broker) declare -A ServerTypes # ServerIDs and their Layer values (levels removed from master) declare -A ServerOTILayers # ServerIDs in outer-to-inner order. declare -a ServerIDsOTI declare -i MaxOTILevels=0 #------------------------------------------------------------------------------ # set -x set_outer_to_inner_upgrade_order "$Instance" "$P4" for host in ${ServerHostsOTI[@]}; do msg "Would run SDP upgrade.sh on host $host." done
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 29182 | C. Thomas Tyler |
Moved HMS files from /p4/common/bin -> /p4/common/site/bin. Moved HMS files from /p4/common/lib -> /p4/common/site/lib. Removed dependency on SDP libs so that HMS can be deployed with a wider variety of SDP versions. |
||
#1 | 27748 | C. Thomas Tyler |
First pass at "outer to inner" implementation, adding a new test for same. Removed some DEMO HACK code; more to be removed. |