Skip to content

Commit 94bd013

Browse files
committed
toolbox: Improve retry loop for ansible-galaxy
Currently if it somehow fails for 5 times - we get exit code 0. Closes-Bug: #2052293 Change-Id: I2bdeb77e3133123053b05adcbde3a426c60f3304
1 parent d7a0310 commit 94bd013

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docker/kolla-toolbox/Dockerfile.j2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ RUN {{ macros.install_pip(['pip', 'wheel', 'setuptools']) }} \
8585

8686
{% block kolla_toolbox_collections_install %}
8787
COPY requirements.yml /var/lib/ansible/
88-
RUN for i in {1..5}; do ansible-galaxy collection install --timeout 120 -p /usr/share/ansible/collections -r /var/lib/ansible/requirements.yml \
89-
&& break || sleep 15; done
88+
RUN fail=1; for i in $(seq 1 5); do if \
89+
ansible-galaxy collection install --timeout 120 -p /usr/share/ansible/collections -r /var/lib/ansible/requirements.yml \
90+
; then fail=0; break; fi; echo "Collection download failed, retrying"; sleep 5; done; \
91+
if [ "$fail" -eq 1 ]; then exit 1; fi
9092

9193
ENV ANSIBLE_LIBRARY /usr/share/ansible:$ANSIBLE_LIBRARY
9294
{% endblock %}

0 commit comments

Comments
 (0)