roles: bifrost-ironic-install: Retry failed pip installation

This is similar to commit c180998193 ("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
This commit is contained in:
Markos Chandras 2017-03-20 10:43:14 +00:00
parent 36e32ecdc2
commit 77bebc92f8

View File

@ -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 '{}' }}"