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
changes/57/27457/1
Alexander Lutay 6 years ago
parent c0e8b89e61
commit b098a7d381

@ -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

Loading…
Cancel
Save