From 4437ffbe602e1e8a536e2b0c8acec4c2acdcae01 Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Wed, 4 Dec 2024 15:03:59 -0700 Subject: [PATCH] Also install testkey for lnav Signed-off-by: Nicolas Bock --- tools/juju-lnav | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/juju-lnav b/tools/juju-lnav index 89e45918..2d48c096 100755 --- a/tools/juju-lnav +++ b/tools/juju-lnav @@ -10,9 +10,20 @@ install_ssh_key() { local unit for unit in $@; do echo "installing ssh key for ${unit}" - cat ~/.ssh/id_rsa.pub \ - | timeout 10 juju ssh ${unit} \ - -- sudo tee --append /root/.ssh/authorized_keys + if [[ -f ~/testkey.pub ]]; then + cat ~/testkey.pub \ + | timeout 10 juju ssh ${unit} \ + -- sudo tee --append /root/.ssh/authorized_keys + else + echo "missing key: ~/testkey.pub" + fi + if [[ -f ~/.ssh/id_rsa.pub ]]; then + cat ~/.ssh/id_rsa.pub \ + | timeout 10 juju ssh ${unit} \ + -- sudo tee --append /root/.ssh/authorized_keys + else + echo "missing key: ~/.ssh/id_rsa.pub" + fi done }