Add custom venv support for proxies

This commit is contained in:
Ashley Nelson
2020-01-24 13:58:08 -06:00
parent d6c70e8d3a
commit ab3a728032

View File

@@ -154,9 +154,22 @@ spec:
serviceAccountName: awx serviceAccountName: awx
terminationGracePeriodSeconds: 10 terminationGracePeriodSeconds: 10
{% if custom_venvs is defined %} {% if custom_venvs is defined %}
{% set trusted_hosts = "" %}
initContainers: initContainers:
- image: 'centos:7' - image: 'centos:7'
name: init-custom-venvs name: init-custom-venvs
{% if http_proxy is defined or https_proxy is defined %}
{% set trusted_hosts = "--trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org" %}
env:
{% if http_proxy is defined %}
- name: http_proxy
value: {{ http_proxy }}
{% endif %}
{% if https_proxy is defined %}
- name: https_proxy
value: {{ https_proxy }}
{% endif %}
{% endif %}
command: command:
- sh - sh
- '-c' - '-c'
@@ -169,10 +182,10 @@ spec:
virtualenv -p {{ custom_venv.python | default(custom_venvs_python) }} \ virtualenv -p {{ custom_venv.python | default(custom_venvs_python) }} \
{{ custom_venvs_path }}/{{ custom_venv.name }} && {{ custom_venvs_path }}/{{ custom_venv.name }} &&
source {{ custom_venvs_path }}/{{ custom_venv.name }}/bin/activate && source {{ custom_venvs_path }}/{{ custom_venv.name }}/bin/activate &&
{{ custom_venvs_path }}/{{ custom_venv.name }}/bin/pip install -U psutil \ {{ custom_venvs_path }}/{{ custom_venv.name }}/bin/pip install {{ trusted_hosts }} -U psutil \
"ansible=={{ custom_venv.python_ansible_version }}" && "ansible=={{ custom_venv.python_ansible_version }}" &&
{% if custom_venv.python_modules is defined %} {% if custom_venv.python_modules is defined %}
{{ custom_venvs_path }}/{{ custom_venv.name }}/bin/pip install -U \ {{ custom_venvs_path }}/{{ custom_venv.name }}/bin/pip install {{ trusted_hosts }} -U \
{% for module in custom_venv.python_modules %}{{ module }} {% endfor %} && {% for module in custom_venv.python_modules %}{{ module }} {% endfor %} &&
{% endif %} {% endif %}
deactivate && deactivate &&