From daebe90b6e7434759969fc9a306792685b08165a Mon Sep 17 00:00:00 2001 From: William Wernert Date: Mon, 1 Feb 2021 12:06:19 -0500 Subject: [PATCH] [fix] fix retry command handling * use eval "$cmd" to handle strings correctly * add-apt-repo doesn't need dpkg lock so don't use retry for those lines --- salt/common/tools/sbin/so-common | 2 +- setup/so-functions | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index aa5e05230..3cf1f5e88 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -229,7 +229,7 @@ retry() { while [[ $attempt -lt $maxAttempts ]]; do attempt=$((attempt+1)) echo "Executing command with retry support: $cmd" - output=$("$cmd") + output=$(eval "$cmd") exitcode=$? echo "Results: $output ($exitcode)" if [ -n "$expectedOutput" ]; then diff --git a/setup/so-functions b/setup/so-functions index 5a7caf849..e7112163e 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1045,8 +1045,7 @@ docker_install() { ;; *) retry 50 10 "apt-key add $temp_install_dir/gpg/docker.pub" >> "$setup_log" 2>&1 || exit 1 - retry 50 10 "add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"" >> "$setup_log" 2>&1 \ - || exit 1 + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" >> "$setup_log" 2>&1 retry 50 10 "apt-get update" >> "$setup_log" 2>&1 || exit 1 ;; esac @@ -1992,7 +1991,7 @@ saltify() { # Add Docker repo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - >> "$setup_log" 2>&1 - retry 50 10 "add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"" >> "$setup_log" 2>&1 || exit 1 + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" >> "$setup_log" 2>&1 # Get gpg keys mkdir -p /opt/so/gpg >> "$setup_log" 2>&1