Simplify - inline pull command
As now there is only one option for pull command, it can be inlined.
Also increased the sleep time with each retry to give it a bit
more time in case of repeated failure.
@@ -18,19 +18,18 @@ function prefetch-images::find_node_names() {
function prefetch-images::pull_on_nodes() {
local -r containers_to_pull=$@
local -r nodes=$(prefetch-images::find_node_names)
- # only internal providers are supported (we have control over the nodes), and there we know it's docker
- local -r pull_command="docker"
local -r max_retry=10
for node in ${nodes[@]}; do
count=0
- until ${KUBEVIRT_PATH}cluster-up/ssh.sh ${node} "echo \"${containers_to_pull}\" | xargs \-\-max-args=1 sudo ${pull_command} pull"; do
+ until ${KUBEVIRT_PATH}cluster-up/ssh.sh ${node} "echo \"${containers_to_pull}\" | xargs \-\-max-args=1 sudo docker pull"; do
count=$((count + 1))
if [ $count -eq max_retry ]; then
- echo "Failed to '${pull_command} pull' in ${node}" >&2
+ echo "Failed to 'docker pull' in ${node}" >&2
exit 1
fi
- sleep 1
+ # increase the sleep time with each retry to give it a bit more time in case of repeated failures
+ sleep $count
done
done
}
@@ -39,19 +38,18 @@ function prefetch-images::pull_on_nodes() {
function prefetch-images::tag_on_nodes() {
local -r container_alias=$@
local -r nodes=$(prefetch-images::find_node_names)
- # only internal providers are supported, (we have control over the nodes) and there we know it's docker
- local -r pull_command="docker"
local -r max_retry=10
for node in ${nodes[@]}; do
count=0
- until ${KUBEVIRT_PATH}cluster-up/ssh.sh ${node} "echo \"${container_alias}\" | xargs \-\-max-args=2 sudo ${pull_command} tag"; do
+ until ${KUBEVIRT_PATH}cluster-up/ssh.sh ${node} "echo \"${container_alias}\" | xargs \-\-max-args=2 sudo docker tag"; do
count=$((count + 1))
if [ $count -eq max_retry ]; then
- echo "Failed to '${pull_command} tag' in ${node}" >&2
+ echo "Failed to 'docker tag' in ${node}" >&2
exit 1
fi
- sleep 1
+ # increase the sleep time with each retry to give it a bit more time in case of repeated failures
+ sleep $count
done
done
}
