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 "clientIpList=()" >> "$configFile"
|
||||||
echo "Looking for client instances..."
|
echo "Looking for client instances..."
|
||||||
gcloud_FindInstances "name~^$prefix-client" show
|
gcloud_FindInstances "name~^$prefix-client" show
|
||||||
if [[ ${#instances[@]} -gt 0 ]]; then
|
[[ ${#instances[@]} -eq 0 ]] || {
|
||||||
gcloud_PrepInstancesForSsh "$gcloud_username" "$sshPrivateKey"
|
gcloud_PrepInstancesForSsh "$gcloud_username" "$sshPrivateKey"
|
||||||
gcloud_ForEachInstance recordInstanceIp clientIpList
|
gcloud_ForEachInstance recordInstanceIp clientIpList
|
||||||
fi
|
}
|
||||||
|
|
||||||
echo "Wrote $configFile"
|
echo "Wrote $configFile"
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,6 +241,10 @@ gcloud_PrepInstancesForSsh() {
|
||||||
IFS=: read -r name zone publicIp _ < <(echo "$instanceInfo")
|
IFS=: read -r name zone publicIp _ < <(echo "$instanceInfo")
|
||||||
|
|
||||||
logFile="$logDir/gcloud_PrepInstancesForSsh-$name.log"
|
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
|
set -x
|
||||||
|
|
||||||
|
@ -260,12 +264,15 @@ gcloud_PrepInstancesForSsh() {
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
\" > .ssh/config;
|
\" > .ssh/config;
|
||||||
"
|
"
|
||||||
|
) >> "$logFile" 2>&1
|
||||||
|
(
|
||||||
|
set -x
|
||||||
scp \
|
scp \
|
||||||
-o StrictHostKeyChecking=no \
|
-o StrictHostKeyChecking=no \
|
||||||
-o UserKnownHostsFile=/dev/null \
|
-o UserKnownHostsFile=/dev/null \
|
||||||
-i "$privateKey" \
|
-i "$privateKey" \
|
||||||
"$privateKey" "$username@$publicIp:.ssh/id_testnet"
|
"$privateKey" "$username@$publicIp:.ssh/id_testnet"
|
||||||
) > "$logFile" 2>&1 &
|
) >> "$logFile" 2>&1 &
|
||||||
declare pid=$!
|
declare pid=$!
|
||||||
|
|
||||||
ln -sfT "$logFile" "$logDir/gcloud_PrepInstancesForSsh-$pid.log"
|
ln -sfT "$logFile" "$logDir/gcloud_PrepInstancesForSsh-$pid.log"
|
||||||
|
|
Loading…
Reference in New Issue