Merge pull request #8621 from MCyprien/util-verify-prereqs

ubuntu cluster utils.sh verify-ssh-prereqs
This commit is contained in:
Tim Hockin 2015-05-27 12:43:56 -07:00
commit 16db5a9c69

View File

@ -77,7 +77,24 @@ function setClusterInfo() {
# Verify ssh prereqs # Verify ssh prereqs
function verify-prereqs { function verify-prereqs {
# Expect at least one identity to be available. local rc
rc=0
ssh-add -L 1> /dev/null 2> /dev/null || rc="$?"
# "Could not open a connection to your authentication agent."
if [[ "${rc}" -eq 2 ]]; then
eval "$(ssh-agent)" > /dev/null
trap-add "kill ${SSH_AGENT_PID}" EXIT
fi
rc=0
ssh-add -L 1> /dev/null 2> /dev/null || rc="$?"
# "The agent has no identities."
if [[ "${rc}" -eq 1 ]]; then
# Try adding one of the default identities, with or without passphrase.
ssh-add || true
fi
# Expect at least one identity to be available.
if ! ssh-add -L 1> /dev/null 2> /dev/null; then if ! ssh-add -L 1> /dev/null 2> /dev/null; then
echo "Could not find or add an SSH identity." echo "Could not find or add an SSH identity."
echo "Please start ssh-agent, add your identity, and retry." echo "Please start ssh-agent, add your identity, and retry."