Skip to content

Commit 24477c5

Browse files
committed
Fix, system.repo don't use curl on fixed pkgrepo.manage
Change-Id: Id5b5a44f3dfbbdd60442fd2f273b72557fa9e191
1 parent 38727e2 commit 24477c5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

linux/system/repo.sls

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ linux_repo_{{ name }}_key:
9292
- pkgrepo: linux_repo_{{ name }}
9393
{% endif %}
9494
95-
{%- elif repo.key_url|default(False) %}
95+
{# key_url fetch by curl when salt <2017.7, higher version of salt has fixed bug for using a proxy_host/port specified at minion.conf #}
96+
{#
97+
NOTE: curl/cmd.run usage to fetch gpg key has limited functionality behind proxy. Environments with salt >= 2017.7 shoul use
98+
key_url specified at pkgrepo.manage state (which uses properly configured http_host at minion.conf). Older versions of
99+
salt require to have proxy set at ENV and curl way to fetch gpg key here can have a sense for backward compatibility.
100+
#}
101+
{%- if grains['saltversioninfo'] < [2017, 7] %}
102+
{%- elif repo.key_url|default(False) and not repo.key_url.startswith('salt://') %}
96103
97104
linux_repo_{{ name }}_key:
98105
cmd.run:
@@ -104,6 +111,7 @@ linux_repo_{{ name }}_key:
104111
{% else %}
105112
- pkgrepo: linux_repo_{{ name }}
106113
{% endif %}
114+
{%- endif %} {# key_url fetch by curl when salt <2017.7 #}
107115
108116
{%- endif %} {# 2 #}
109117
@@ -132,6 +140,9 @@ linux_repo_{{ name }}:
132140
{%- if repo.key_server is defined %}
133141
- keyserver: {{ repo.key_server }}
134142
{%- endif %}
143+
{%- if repo.key_url is defined and grains['saltversioninfo'] >= [2017, 7] %}
144+
- key_url: {{ repo.key_url }}
145+
{%- endif %}
135146
- consolidate: {{ repo.get('consolidate', False) }}
136147
- clean_file: {{ repo.get('clean_file', False) }}
137148
- refresh_db: {{ repo.get('refresh_db', True) }}

0 commit comments

Comments
 (0)