Browse Source

feat(repositories): allow to specify custom filename

tags/v0.11.0
Javier Bértoli 2 years ago
parent
commit
2a7e4afe5a
4 changed files with 30 additions and 2 deletions
  1. +3
    -2
      apt/repositories.sls
  2. +3
    -0
      pillar.example
  3. +16
    -0
      test/integration/repositories/controls/repositories_spec.rb
  4. +8
    -0
      test/salt/pillar/repositories.sls

+ 3
- 2
apt/repositories.sls View File

{%- set r_keyserver = args.keyserver if args.keyserver is defined else apt_map.default_keyserver %} {%- set r_keyserver = args.keyserver if args.keyserver is defined else apt_map.default_keyserver %}


{%- for type in args.type|d(['binary']) %} {%- for type in args.type|d(['binary']) %}
{%- set r_type = 'deb-src' if type == 'source' else 'deb' %}
{%- set r_type = 'deb-src' if type == 'source' else 'deb' %}
{%- set r_file = args.filename if args.filename is defined else repo ~ '-' ~ type ~ '.list' %}


{{ r_type }} {{ repo }}: {{ r_type }} {{ repo }}:
pkgrepo.managed: pkgrepo.managed:
- name: {{ r_type }} {{ r_options }} {{ r_url }} {{ r_distro }} {{ r_comps }} - name: {{ r_type }} {{ r_options }} {{ r_url }} {{ r_distro }} {{ r_comps }}
- file: {{ sources_list_dir }}/{{ repo }}-{{ type }}.list
- file: {{ sources_list_dir }}/{{ r_file }}
{# You can use either keyid+keyserver or key_url. If both are provided {# You can use either keyid+keyserver or key_url. If both are provided
the latter will be used. #} the latter will be used. #}
{% if args.key_url is defined %} {% if args.key_url is defined %}

+ 3
- 0
pillar.example View File

comps: [main, contrib, non-free] comps: [main, contrib, non-free]
key_url: https://ftp-master.debian.org/keys/archive-key-10.asc key_url: https://ftp-master.debian.org/keys/archive-key-10.asc
raspbian: raspbian:
# If you want to use a particular filename under /etc/apt/sources.list.d
# set it here, with extension included
filename: my_raspbian_repo.list
distro: stable distro: stable
url: http://archive.raspbian.org/raspbian url: http://archive.raspbian.org/raspbian
type: [source] type: [source]

+ 16
- 0
test/integration/repositories/controls/repositories_spec.rb View File

) )
end end
end end

describe file('/etc/apt/sources.list.d/my_raspbian_repo.list') do
it { should exist }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
its(:content) do
should match(
%r{deb-src http://archive.raspbian.org/raspbian stable main}
)
end
end

describe file('/etc/apt/sources.list.d/raspbian-binary.list') do
it { should_not exist }
end
end end

+ 8
- 0
test/salt/pillar/repositories.sls View File

arch: [amd64] arch: [amd64]
comps: [] comps: []
key_url: https://cli-assets.heroku.com/apt/release.key key_url: https://cli-assets.heroku.com/apt/release.key
raspbian:
# If you want to use a particular filename under /etc/apt/sources.list.d
# set it here, with extension included
filename: my_raspbian_repo.list
distro: stable
url: http://archive.raspbian.org/raspbian
type: [source]
key_url: https://archive.raspbian.org/raspbian.public.key

Loading…
Cancel
Save