Work around concurrent |gcloud compute ssh| terminal issue
This commit is contained in:
parent
e677cda027
commit
89db85dbf9
|
@ -158,10 +158,10 @@ EOF
|
|||
echo "clientIpList=()" >> "$configFile"
|
||||
echo "Looking for client instances..."
|
||||
gcloud_FindInstances "name~^$prefix-client" show
|
||||
if [[ ${#instances[@]} -gt 0 ]]; then
|
||||
[[ ${#instances[@]} -eq 0 ]] || {
|
||||
gcloud_PrepInstancesForSsh "$gcloud_username" "$sshPrivateKey"
|
||||
gcloud_ForEachInstance recordInstanceIp clientIpList
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Wrote $configFile"
|
||||
}
|
||||
|
|
|
@ -241,6 +241,10 @@ gcloud_PrepInstancesForSsh() {
|
|||
IFS=: read -r name zone publicIp _ < <(echo "$instanceInfo")
|
||||
|
||||
logFile="$logDir/gcloud_PrepInstancesForSsh-$name.log"
|
||||
|
||||
# TODO: This next subshell runs in series because for unknown reason running
|
||||
# multiple |gcloud compute ssh| commands in parallel cause the macOS
|
||||
# terminal to misbehave
|
||||
(
|
||||
set -x
|
||||
|
||||
|
@ -260,12 +264,15 @@ gcloud_PrepInstancesForSsh() {
|
|||
StrictHostKeyChecking no
|
||||
\" > .ssh/config;
|
||||
"
|
||||
) >> "$logFile" 2>&1
|
||||
(
|
||||
set -x
|
||||
scp \
|
||||
-o StrictHostKeyChecking=no \
|
||||
-o UserKnownHostsFile=/dev/null \
|
||||
-i "$privateKey" \
|
||||
"$privateKey" "$username@$publicIp:.ssh/id_testnet"
|
||||
) > "$logFile" 2>&1 &
|
||||
) >> "$logFile" 2>&1 &
|
||||
declare pid=$!
|
||||
|
||||
ln -sfT "$logFile" "$logDir/gcloud_PrepInstancesForSsh-$pid.log"
|
||||
|
|
Loading…
Reference in New Issue