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

@@ -13,7 +13,8 @@ provisioner:
log_level: error
formula: linux
grains:
noservices: true
noservices: True
kitchen-test: True
state_top:
base:
"*":

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

@@ -80,9 +80,21 @@ linux_repo_{{ name }}_pin:
{%- if repo.get('key') %} {# 2 #}

linux_repo_{{ name }}_key:
{% if grains['saltversioninfo'] < [2017, 7] %}
cmd.run:
- name: |
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:
{%- if repo.get('default', False) %}
- file: default_repo_list
@@ -104,6 +116,10 @@ linux_repo_{{ name }}_key:
linux_repo_{{ name }}_key:
cmd.run:
- 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:
{%- if repo.get('default', False) %}
- file: default_repo_list

Loading…
Cancel
Save