diff options
author | Bernard Ogden <bernie.ogden@linaro.org> | 2015-07-22 15:26:08 +0200 |
---|---|---|
committer | Bernard Ogden <bernie.ogden@linaro.org> | 2015-07-22 17:38:10 +0200 |
commit | 1e303d1ca358f8e7595eb3b924d2b44ad0427292 (patch) | |
tree | 1407720f57362cb32de571d8f905b98985ef9bf2 | |
parent | b3ea8788a1783685a523039eb3481d2a579c027e (diff) |
Wait for a private key rather than an agent
Private key doesn't have to be kept up - this is fine so long as
we use a one-time key, as is the plan for Jenkins.
Change-Id: I22767bd6a92d66d28e9dbada644d746aeb41b928
-rwxr-xr-x | invoke_session_debian | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/invoke_session_debian b/invoke_session_debian index e860a67..a9c8d50 100755 --- a/invoke_session_debian +++ b/invoke_session_debian @@ -79,8 +79,15 @@ if ! ssh -i ~/data/onetime -o StrictHostKeyChecking=no localhost true; then fi #This would be two agents if we wanted one for source, one for job -echo "*** WAITING FOR AGENT: ${ip_addr}" -while ! ssh-add -l &> /dev/null; do inotifywait -e create /tmp; done +mkdir ~/data || exit 1 +chmod 700 ~/data || exit 1 +echo "*** WAITING FOR KEY: ${ip_addr}" +while ! test -e ~/data/targetkey; do + inotifywait -e create ~/data +done +chmod 600 ~/data/targetkey || exit 1 +eval `ssh-agent` +ssh-add ~/data/targetkey || exit 1 echo "" mkdir -p /run mkdir -p /run/hacking @@ -98,6 +105,13 @@ for lava_name in `lava-group | grep -v '[[:blank:]]*host$' | awk '{print $1}'`; if test $? -ne 0; then echo "Failed to find IP for ${lava_name}"; sleep infinity; exit 1; fi if test -z "${target_ip}"; then echo "Failed to find IP for ${lava_name}"; sleep infinity; exit 1; fi echo "IP ${target_ip}" + + #Check that target is accessible, add to known_hosts + if ! ssh -o StrictHostKeyChecking=no true; then + echo "Could not access target ${target_ip} (${lava_name})" >&2 + exit 1 + fi + target_base="$(echo ${lava_name} | sed 's/[[:digit:]]*$//')" #TODO: HACK if test $? -ne 0; then echo "Failed to find target type from ${lava_name}"; exit 1; fi echo "TYPE ${target_base}" |