From 7f7f3769b31134a81aba028de0905f8a9702cb8a Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 18 Feb 2019 15:45:36 +0100 Subject: [PATCH] main: add a retry/until for python installation Add a retry/until in raw_install_python.yml to avoid unexpected repository failures. Signed-off-by: Guillaume Abrioux --- raw_install_python.yml | 8 +++++++- site.yml.sample | 2 ++ tox.ini | 14 +++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/raw_install_python.yml b/raw_install_python.yml index 28d1a45be..7c9ab15d0 100644 --- a/raw_install_python.yml +++ b/raw_install_python.yml @@ -8,17 +8,23 @@ - name: install python for debian based systems raw: apt-get -y install python-simplejson ignore_errors: yes + register: result when: - systempython.stat is undefined or not systempython.stat.exists + until: result is succeeded - name: install python for fedora raw: dnf -y install python3; ln -sf /usr/bin/python3 /usr/bin/python creates=/usr/bin/python ignore_errors: yes + register: result when: - systempython.stat is undefined or not systempython.stat.exists + until: (result is succeeded) or ('Failed' not in result.stdout) - name: install python for opensuse raw: zypper -n install python-base creates=/usr/bin/python2.7 ignore_errors: yes + register: result when: - - systempython.stat is undefined or not systempython.stat.exists \ No newline at end of file + - systempython.stat is undefined or not systempython.stat.exists + until: result is succeeded \ No newline at end of file diff --git a/site.yml.sample b/site.yml.sample index cf7f62038..ba7228ad2 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -46,9 +46,11 @@ - name: install required packages for fedora > 23 raw: sudo dnf -y install python2-dnf libselinux-python ntp + register: result when: - ansible_distribution == 'Fedora' - ansible_distribution_major_version|int >= 23 + until: result is succeeded - name: check if it is atomic host stat: diff --git a/tox.ini b/tox.ini index 039788d5d..f8a74b987 100644 --- a/tox.ini +++ b/tox.ini @@ -71,7 +71,7 @@ commands= ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \ " # test that the cluster can be redeployed in a healthy state - testinfra -n 8 --durations=0 -rfEsxXpP --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests + testinfra -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests [purge-lvm] commands= @@ -99,7 +99,7 @@ commands= ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \ " # test that the cluster can be redeployed in a healthy state - testinfra -n 8 --durations=0 -rfEsxXpP --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests + testinfra -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests # extra commands for performing a rolling update [update] @@ -116,7 +116,7 @@ commands= ceph_dev_sha1={env:UPDATE_CEPH_DEV_SHA1:latest} \ " - bash -c "CEPH_STABLE_RELEASE={env:UPDATE_CEPH_STABLE_RELEASE:nautilus} testinfra -n 8 --durations=0 -rfEsxXpP --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests" + bash -c "CEPH_STABLE_RELEASE={env:UPDATE_CEPH_STABLE_RELEASE:nautilus} testinfra -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests" [shrink-mon] commands= @@ -150,7 +150,7 @@ commands= ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \ " - testinfra -n 8 --durations=0 -rfEsxXpP --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-switch-to-containers {toxinidir}/tests/functional/tests + testinfra -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-switch-to-containers {toxinidir}/tests/functional/tests [add-osds] commands= @@ -167,7 +167,7 @@ commands= ceph_dev_branch={env:CEPH_DEV_BRANCH:master} \ ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \ " - testinfra -n 8 --durations=0 -rfEsxXpP --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 {toxinidir}/tests/functional/tests + testinfra -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/hosts-2 {toxinidir}/tests/functional/tests [rgw-multisite] commands= @@ -312,7 +312,7 @@ commands= # wait 30sec for services to be ready sleep 30 # test cluster state using ceph-ansible tests - testinfra -n 8 --durations=0 -rfEsxXpP --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests + testinfra -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests # reboot all vms ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/reboot.yml @@ -320,7 +320,7 @@ commands= # wait 30sec for services to be ready sleep 30 # retest to ensure cluster came back up correctly after rebooting - testinfra -n 8 --durations=0 -rfEsxXpP --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests + testinfra -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} {toxinidir}/tests/functional/tests # handlers/idempotency test ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} \