Browse Source

system.repo call curl with proxy env.

Change-Id: If5a8d56cc950ad0730ac728da20875a5c92bc194
fix-curl-behind-proxy2-proper-withcurlproxy
Petr Michalec 6 years ago
parent
commit
c6b091150e
No account linked to committer's email address
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      linux/system/repo.sls

+ 3
- 2
linux/system/repo.sls View File

#} #}
{%- elif repo.key_url|default(False) and grains['saltversioninfo'] < [2017, 7] and not repo.key_url.startswith('salt://') %} {%- elif repo.key_url|default(False) and grains['saltversioninfo'] < [2017, 7] and not repo.key_url.startswith('salt://') %}


{% set _export_proxy = "export no_proxy=${no_proxy:-" + system.proxy.get('noproxy', []) |join(',') + "} http_proxy=${http_proxy:-" + system.proxy.get('http', '') + "} https_proxy=${https_proxy:-" + system.proxy.get('https', '') +"}; " %}


linux_repo_{{ name }}_key: linux_repo_{{ name }}_key:
cmd.run: cmd.run:
- name: "curl -sL {{ repo.key_url }} | apt-key add -"
- name: "{{ _export_proxy }} curl -sL {{ repo.key_url }} | apt-key add -"
{%- if not grains.get('kitchen-test') %} {%- if not grains.get('kitchen-test') %}
{# omitted from tests, as behaves inconsistently across CI/platforms #} {# omitted from tests, as behaves inconsistently across CI/platforms #}
- unless: "apt-key finger --with-colons | grep -qF $(curl -sL {{ repo.key_url }} | gpg --with-fingerprint --with-colons | grep -E '^fpr')"
- unless: "apt-key finger --with-colons | grep -qF $({{ _export_proxy }} curl -sL {{ repo.key_url }} | gpg --with-fingerprint --with-colons | grep -E '^fpr')"
{%- endif %} {%- endif %}
- require_in: - require_in:
{%- if repo.get('default', False) %} {%- if repo.get('default', False) %}

Loading…
Cancel
Save