ensure known_hosts exist
Locally running ONOS was failing on fresh machine
where known_hosts doesn't exist yet.
Change-Id: I83beb0118f6f41e8b24eff1ab7cb53d2ca95f853
diff --git a/tools/test/bin/onos-secure-ssh b/tools/test/bin/onos-secure-ssh
index 24a5a48..cd9f12c 100755
--- a/tools/test/bin/onos-secure-ssh
+++ b/tools/test/bin/onos-secure-ssh
@@ -19,9 +19,12 @@
nodes=${1:-$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)}
+# ensure known_hosts file exist
+(umask 077; touch "$HOME/.ssh/known_hosts")
+
for node in $nodes; do
# Prune the node entry from the known hosts file since server key changes
- ssh-keygen -f "$HOME/.ssh/known_hosts" -R [$node]:8101 ||
+ ssh-keygen -f "$HOME/.ssh/known_hosts" -R [$node]:8101 ||
( echo "Failed to remove key from known_hosts" >&2 && exit 1 )
# Setup passwordless login for the local user on the remote node
@@ -42,4 +45,3 @@
# TODO: fix username collision between workbench and the remote hosts
onos-user-key $node
done
-