From 77bebc92f883904b45769a76533cbe0973bb7d8b Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 20 Mar 2017 10:43:14 +0000 Subject: [PATCH] roles: bifrost-ironic-install: Retry failed pip installation This is similar to commit c180998193c9 ("playbooks: roles: bifrost-ironic-install: Retry failed PXE downloads"). Fetching dependencies from the PYPI website may fail for various reasons so retry installing the packages a few times before giving up. This aims to workaround problems like the following one: TASK [bifrost-ironic-install : Install ironic-inspector package from pip] ****** [...] fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": "/bin/pip install -U ironic-inspector", "failed": true, "invocation": {"module_args": {"chdir": null, "editable": true, "executable": null, "extra_args": null, "name": "ironic-inspector", "requirements": null, "state": "latest", "umask": null, "use_mirrors": true, "version": null, "virtualenv": "", "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false}, "module_name": "pip"}, "msg": "\n:stderr: Exception: [...] raise RetryError(e, request=request)\nRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/ironic-inspector/ (Caused by ResponseError('too many 503 error responses',)) Change-Id: I2a1958d661c41e3c635598c165f285b617053aad --- .../roles/bifrost-ironic-install/tasks/pip_install.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml b/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml index 4ee2eb16a..4226ca0ef 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/pip_install.yml @@ -27,11 +27,19 @@ virtualenv: "{{ bifrost_venv_dir if enable_venv else omit }}" virtualenv_command: "{{ venv_command | default(omit) }}" extra_args: "{{ extra_args | default(omit) }}" + register: pip_package_install_done + until: pip_package_install_done|succeeded + retries: 5 + delay: 10 when: source_install is not defined or source_install == false # NOTE (cinerama): We should be able to use the pip module here and # possibly merge these two tasks when # https://github.com/ansible/ansible-modules-core/pull/2600 lands. - name: "Install from {{ sourcedir }} using pip" command: pip install {{ sourcedir }} {{ extra_args | default('') }} + register: pip_package_install_done + until: pip_package_install_done|succeeded + retries: 5 + delay: 10 when: source_install is defined and (source_install | bool == true) environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"