Browse Source

Merge "Fix system:repo"

pull/153/head
mcp-jenkins 6 years ago
parent
commit
e959ef234a
1 changed files with 19 additions and 36 deletions
  1. +19
    -36
      linux/system/repo.sls

+ 19
- 36
linux/system/repo.sls View File



purge_sources_list_d_repos: purge_sources_list_d_repos:
file.directory: file.directory:
- name: /etc/apt/sources.list.d/
- name: /etc/apt/sources.list.d/
- clean: True - clean: True


{%- endif %} {%- endif %}


{%- endif %} {%- endif %}


{%- if repo.get('default', False) %}

{%- do default_repos.update({name: repo}) %}

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


linux_repo_{{ name }}_key: linux_repo_{{ name }}_key:
cmd.wait:
- name: "echo -e '{{ repo.key|replace('\n', '\\n') }}' | apt-key add -"
- watch:
- file: default_repo_list
cmd.run:
- name: |
echo "{{ repo.key | indent(12) }}" | apt-key add -
- unless: |
apt-key finger --with-colons | grep -qF $(echo "{{ repo.key| indent(12) }}" | gpg --with-fingerprint --with-colons | grep -E '^fpr')
- require_in:
- pkgrepo: linux_repo_{{ name }}


{%- elif repo.key_url|default(False) %} {%- elif repo.key_url|default(False) %}


linux_repo_{{ name }}_key: linux_repo_{{ name }}_key:
cmd.wait:
cmd.run:
- name: "curl -sL {{ repo.key_url }} | apt-key add -" - name: "curl -sL {{ repo.key_url }} | apt-key add -"
- watch:
- file: default_repo_list
- unless: "apt-key finger --with-colons | grep -qF $(curl -sL {{ repo.key_url }} | gpg --with-fingerprint --with-colons | grep -E '^fpr')"
- require_in:
- pkgrepo: linux_repo_{{ name }}


{%- endif %}
{%- endif %} {# 2 #}


{%- else %}
{%- if repo.get('default', False) %} {# 1 #}
{%- do default_repos.update({name: repo}) %} {# for 'default' repos #}

{%- else %} {# for all others repos #}


{%- if repo.get('enabled', True) %} {%- if repo.get('enabled', True) %}


{%- endif %} {%- endif %}
{%- endif %} {%- endif %}


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

linux_repo_{{ name }}_key:
cmd.run:
- name: "echo -e '{{ repo.key|replace('\n', '\\n') }}' | apt-key add -"
- unless: "apt-key finger --with-colons | grep -qF $(echo -e '{{ repo.key|replace('\n', '\\n') }}' | gpg --with-fingerprint --with-colons | grep -E '^fpr')"
- require_in:
- pkgrepo: linux_repo_{{ name }}

{%- elif repo.key_url|default(False) %}

linux_repo_{{ name }}_key:
cmd.run:
- name: "curl -sL {{ repo.key_url }} | apt-key add -"
- unless: "apt-key finger --with-colons | grep -qF $(curl -sL {{ repo.key_url }} | gpg --with-fingerprint --with-colons | grep -E '^fpr')"
- require_in:
- pkgrepo: linux_repo_{{ name }}

{%- endif %}

{%- else %} {%- else %}


linux_repo_{{ name }}_absent: linux_repo_{{ name }}_absent:


{%- endif %} {%- endif %}


{%- endif %}
{%- endif %} {# 1 #}


{#- os_family Debian #} {#- os_family Debian #}
{%- endif %} {%- endif %}

Loading…
Cancel
Save