Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(repositories): allow to specify custom filename #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apt/repositories.sls
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@
{%- set r_keyserver = args.keyserver if args.keyserver is defined else apt_map.default_keyserver %}

{%- 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 }}:
pkgrepo.managed:
- 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
the latter will be used. #}
{% if args.key_url is defined %}
Expand Down
3 changes: 3 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ apt:
comps: [main, contrib, non-free]
key_url: https://ftp-master.debian.org/keys/archive-key-10.asc
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]
Expand Down
16 changes: 16 additions & 0 deletions test/integration/repositories/controls/repositories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,20 @@
)
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
8 changes: 8 additions & 0 deletions test/salt/pillar/repositories.sls
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ apt:
arch: [amd64]
comps: []
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