-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Could you please add feature that will check SSH connection to cloud before doing any SSH requests.
See an example:
doMagentoCloudLogin()
{
read -n 1 -p "Do you want to connect via magento-cloud? [Y/n]: " GO
if [[ ! -z "GO" && $GO != "n" ]]; then
magento-cloud login -f
if [[ $? -eq 1 ]]; then
printNotice "Authorization rejected. Exit."
final 1
fi
else
printNotice "Authorization failed. Exit."
final 1
fi
}
checkSsh()
{
if [[ -z $LOGGED_IN ]]; then
printNotice "Checking SSH authorization..."
status=$(ssh -o BatchMode=yes -o ConnectTimeout=5 $1 echo ok 2>&1)
if [[ $status == ok ]]; then
printStatus "SSH authorization" "OK"
LOGGED_IN=1
elif [[ $status == "Permission denied"* ]] ; then
printNotice "Permission denied."
doMagentoCloudLogin
else
printNotice "Error: $status"
doMagentoCloudLogin
fi
fi
}
where $1 is SSH uri like: 1.ent-rbbhqz455ie4c-staging-5em2ouy@ssh.ap-3.magento.cloud
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels