Add ability to set direct access to repositories.
In case of using proxy for APT repositories added ability to exclude
some repositories to use direct access.
Closes-bug: PROD-36122
Change-Id: I5549498885e3204b4ecb56f7eb8c845cb076507c
diff --git a/README.rst b/README.rst
index 1f6d3d9..03dc3d5 100644
--- a/README.rst
+++ b/README.rst
@@ -1157,6 +1157,35 @@
http: http://proxy.host.local:3142
https: https://proxy.host.local:3143
+Package manager direct access setup:
+
+.. code-block:: yaml
+
+ linux:
+ system:
+ ...
+ repo:
+ apt-mk:
+ source: "deb http://apt-mk.mirantis.com/ stable main salt"
+ ...
+ proxy:
+ pkg:
+ enabled: true
+ ftp: ftp://ftp-proxy-for-apt.host.local:2121
+ ...
+ # NOTE: Global defaults for any other componet that configure proxy on the system.
+ # If your environment has just one simple proxy, set it on linux:system:proxy.
+ #
+ # fall back system defaults if linux:system:proxy:pkg has no protocol specific entries
+ # as for https and http
+ ftp: ftp://proxy.host.local:2121
+ http: http://proxy.host.local:3142
+ https: https://proxy.host.local:3143
+ direct:
+ - 192.168.0.100
+ - repo.wo.proxy.local
+
+
Package manager proxy setup per repository:
.. code-block:: yaml
diff --git a/linux/files/apt.conf.d_proxies b/linux/files/apt.conf.d_proxies
index ca53711..a0ff2de 100644
--- a/linux/files/apt.conf.d_proxies
+++ b/linux/files/apt.conf.d_proxies
@@ -2,7 +2,14 @@
Acquire::ftp::proxy{%- if external_host %}::{{ external_host }}{% endif %} "{{ ftp }}";
{%- endif %}
{%- if http and http.lower() != 'none' %}
-Acquire::http::proxy{%- if external_host %}::{{ external_host }}{% endif %} "{{ http }}";
+Acquire::http{
+ proxy{%- if external_host %}::{{ external_host }}{% endif %} "{{ http }}";
+ {%- if direct|length > 0 %}
+ {%- for value in direct %}
+ proxy::{{ value }} DIRECT;
+ {%- endfor %}
+ {%- endif -%}
+}
{%- endif %}
{%- if https and https.lower() != 'none' %}
Acquire::https::proxy{%- if external_host %}::{{ external_host }}{% endif %} "{{ https }}";
diff --git a/linux/system/repo.sls b/linux/system/repo.sls
index bf4ca5e..be81207 100644
--- a/linux/system/repo.sls
+++ b/linux/system/repo.sls
@@ -29,6 +29,7 @@
https: {{ system.proxy.get('pkg', {}).get('https', None) | default(system.proxy.get('https', None), true) }}
http: {{ system.proxy.get('pkg', {}).get('http', None) | default(system.proxy.get('http', None), true) }}
ftp: {{ system.proxy.get('pkg', {}).get('ftp', None) | default(system.proxy.get('ftp', None), true) }}
+ direct: {{ system.proxy.get('pkg', {}).get('direct', None) | default(system.proxy.get('direct', []), true) }}
{%- else %}
/etc/apt/apt.conf.d/99proxies-salt:
file.absent
@@ -90,6 +91,7 @@
https: {{ repo.proxy.get('https', None) or system.proxy.get('pkg', {}).get('https', None) | default(system.proxy.get('https', None), True) }}
http: {{ repo.proxy.get('http', None) or system.proxy.get('pkg', {}).get('http', None) | default(system.proxy.get('http', None), True) }}
ftp: {{ repo.proxy.get('ftp', None) or system.proxy.get('pkg', {}).get('ftp', None) | default(system.proxy.get('ftp', None), True) }}
+ direct: {{ repo.proxy.get('direct', None) or system.proxy.get('pkg', {}).get('direct', None) | default(system.proxy.get('direct', []), true) }}
{%- else %}
/etc/apt/apt.conf.d/99proxies-salt-{{ name }}:
file.absent