[fix] Remove sudo from version check, only remove known_hosts entry if exists

This commit is contained in:
William Wernert
2020-12-10 13:13:45 -05:00
parent 86313796a5
commit 21e107f2e8

View File

@@ -519,7 +519,7 @@ check_requirements() {
}
compare_versions() {
manager_ver=$(ssh -i /root/.ssh/so.key soremote@"$MSRV" sudo cat /etc/soversion)
manager_ver=$(ssh -i /root/.ssh/so.key soremote@"$MSRV" cat /etc/soversion)
[[ "$manager_ver" == "$SOVERSION" ]]
return
@@ -660,7 +660,7 @@ copy_ssh_key() {
chown -R "$SUDO_USER":"$SUDO_USER" /root/.ssh
echo "Removing old entry for manager from known_hosts if it exists"
sed -i "/${MSRV}/d" /root/.ssh/known_hosts
grep -q "$MSRV" /root/.ssh/known_hosts && sed -i "/${MSRV}/d" /root/.ssh/known_hosts
echo "Copying the SSH key to the manager"
#Copy the key over to the manager
@@ -921,7 +921,7 @@ docker_seed_registry() {
}
download_repo_tarball() {
manager_ver=$(ssh -i /root/.ssh/so.key soremote@"$MSRV" sudo cat /etc/soversion)
manager_ver=$(ssh -i /root/.ssh/so.key soremote@"$MSRV" cat /etc/soversion)
scp -i /root/.ssh/so.key soremote@"$MSRV":/opt/so/repo/"$manager_ver".tar.gz /root/manager_setup
# Fail if the file doesn't download