@@ -83,21 +83,27 @@ linux_repo_{{ name }}_key:
8383 cmd.run:
8484 - name: |
8585 echo " {{ repo.key | indent(12) }} " | apt- key add -
86- - unless: |
87- apt- key finger -- with - colons | grep - qF $ (echo " {{ repo.key| indent(12) }} " | gpg -- with - fingerprint -- with - colons | grep - E ' ^fpr' )
8886 - require_in:
8987 {%- if repo.get(' default' , False ) % }
9088 - file : default_repo_list
9189 {% else % }
9290 - pkgrepo: linux_repo_{{ name }}
9391 {% endif % }
9492
95- {%- elif repo.key_url| default(False ) % }
93+ {# 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 #}
94+ {#
95+ NOTE : curl/ cmd.run usage to fetch gpg key has limited functionality behind proxy. Environments with salt >= 2017.7 should use
96+ key_url specified at pkgrepo.manage state (which uses properly configured http_host at minion.conf). Older versions of
97+ salt require to have proxy set at ENV and curl way to fetch gpg key here can have a sense for backward compatibility.
98+
99+ Be aware that as of salt 2018.3 no_proxy option is not implemented at all .
100+ # }
101+ {%- elif repo.key_url| default(False ) and grains[' saltversioninfo' ] < [2017 , 7 ] and not repo.key_url.startswith(' salt://' ) % }
102+
96103
97104linux_repo_{{ name }}_key:
98105 cmd.run:
99- - name: " curl -sL {{ repo.key_url }} | apt-key add -"
100- - unless: " apt-key finger --with-colons | grep -qF $(curl -sL {{ repo.key_url }} | gpg --with-fingerprint --with-colons | grep -E '^fpr')"
106+ - name: " curl -sL '{{ repo.key_url }} ' | apt-key add -"
101107 - require_in:
102108 {%- if repo.get(' default' , False ) % }
103109 - file : default_repo_list
@@ -132,6 +138,9 @@ linux_repo_{{ name }}:
132138 {%- if repo.key_server is defined % }
133139 - keyserver: {{ repo.key_server }}
134140 {%- endif % }
141+ {%- if repo.key_url is defined and (grains[' saltversioninfo' ] >= [2017 , 7 ] or repo.key_url.startswith(' salt://' )) % }
142+ - key_url: {{ repo.key_url }}
143+ {%- endif % }
135144 - consolidate: {{ repo.get(' consolidate' , False ) }}
136145 - clean_file: {{ repo.get(' clean_file' , False ) }}
137146 - refresh_db: {{ repo.get(' refresh_db' , True ) }}
0 commit comments