Browse Source

use pkg.add_repo_key and return unless

Change-Id: I111a584879c391cab41ca5579dfcad170a3248ad
fix-curl-behind-proxy2-proper
Petr Michalec 6 years ago
parent
commit
42048b2b2c
No account linked to committer's email address
2 changed files with 18 additions and 1 deletions
  1. +2
    -1
      .kitchen.yml
  2. +16
    -0
      linux/system/repo.sls

+ 2
- 1
.kitchen.yml View File

log_level: error log_level: error
formula: linux formula: linux
grains: grains:
noservices: true
noservices: True
kitchen-test: True
state_top: state_top:
base: base:
"*": "*":

+ 16
- 0
linux/system/repo.sls View File

{%- if repo.get('key') %} {# 2 #} {%- if repo.get('key') %} {# 2 #}


linux_repo_{{ name }}_key: linux_repo_{{ name }}_key:
{% if grains['saltversioninfo'] < [2017, 7] %}
cmd.run: cmd.run:
- name: | - name: |
echo "{{ repo.key | indent(12) }}" | apt-key add - echo "{{ repo.key | indent(12) }}" | apt-key add -
{%- if not grains.get('kitchen-test') %}
{# omitted from tests, as behaves inconsistently across CI/platforms #}
- unless: |
apt-key finger --with-colons | grep -qF $(echo "{{ repo.key| indent(12) }}" | gpg --with-fingerprint --with-colons | grep -E '^fpr')
{%- endif %}
{%- else %}
module.run:
- name: pkg.add_repo_key
- text: |
{{ repo.key | indent(10) }}
{%- endif %}
- require_in: - require_in:
{%- if repo.get('default', False) %} {%- if repo.get('default', False) %}
- file: default_repo_list - file: default_repo_list
linux_repo_{{ name }}_key: linux_repo_{{ name }}_key:
cmd.run: cmd.run:
- name: "curl -sL {{ repo.key_url }} | apt-key add -" - name: "curl -sL {{ repo.key_url }} | apt-key add -"
{%- if not grains.get('kitchen-test') %}
{# 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')"
{%- endif %}
- require_in: - require_in:
{%- if repo.get('default', False) %} {%- if repo.get('default', False) %}
- file: default_repo_list - file: default_repo_list

Loading…
Cancel
Save