From ab42a842997a972896f48d5c3d103a9ea91b08a4 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Fri, 22 Feb 2019 14:34:47 +0100 Subject: [PATCH] TT#53555 Adding sipwise_vagrant_key if it is missing only We were always adding sipwise_vagrant_key which cause sshd service restart and might affect auto testing procedures. See the ticket for more details and logs. Let's add it there if it is missing only. Change-Id: Ic84fc902b17d5d269e77f68488af91f396f11db8 (cherry picked from commit b098a7d3817f33ae68d87cb25ae90e593107e17c) --- deployment.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deployment.sh b/deployment.sh index 8e0b65f..684f6cc 100644 --- a/deployment.sh +++ b/deployment.sh @@ -2128,7 +2128,12 @@ vagrant_configuration() { sed -i 's|^[#\s]*AuthorizedKeysFile.*$|AuthorizedKeysFile %h/.ssh/sipwise_vagrant_key|g' "${TARGET}/etc/ssh/sshd_config" ;; *) - sed -i 's|^[#\s]*\(AuthorizedKeysFile.*\)$|\1 %h/.ssh/sipwise_vagrant_key|g' "${TARGET}/etc/ssh/sshd_config" + if grep -qE "AuthorizedKeysFile.*sipwise_vagrant_key" "${TARGET}/etc/ssh/sshd_config" >/dev/null 2>&1; then + echo "The sipwise_vagrant_key alread available in ${TARGET}/etc/ssh/sshd_config" + else + echo "Adding sipwise_vagrant_key to ${TARGET}/etc/ssh/sshd_config" + sed -i 's|^[#\s]*\(AuthorizedKeysFile.*\)$|\1 %h/.ssh/sipwise_vagrant_key|g' "${TARGET}/etc/ssh/sshd_config" + fi ;; esac