forked from saltstack-formulas/apt-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore .kitchen dir Add defaults for preferences mgmt Add some pillar examples for preferences mgmt Add tests for preferences Add entries in the README file Missing map.jinja entry
- Loading branch information
1 parent
988c59f
commit 6f7022f
Showing
9 changed files
with
152 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.swp | ||
.kitchen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% from "apt/map.jinja" import apt as apt_map with context %} | ||
{% set apt = pillar.get('apt', {}) %} | ||
{% set remove_preferences = apt.get('remove_preferences', apt_map.remove_preferences) %} | ||
{% set clean_preferences_d = apt.get('clean_preferences_d', apt_map.clean_preferences_d) %} | ||
{% set preferences_dir = apt.get('preferences_dir', apt_map.preferences_dir) %} | ||
{% set preferences = apt.get('preferences', apt_map.preferences) %} | ||
{% set default_url = apt.get('default_url', apt_map.default_url) %} | ||
/etc/apt/preferences: | ||
{% if remove_preferences %} | ||
file.absent | ||
{% else %} | ||
file.managed: | ||
- mode: '0644' | ||
- user: root | ||
- group: root | ||
{% endif %} | ||
{{ preferences_dir }}: | ||
file.directory: | ||
- mode: '0755' | ||
- user: root | ||
- group: root | ||
- clean: {{ clean_preferences_d }} | ||
{% for pref_file, args in preferences.iteritems() %} | ||
{%- set p_package = args.package if args.package is defined else '*' %} | ||
{{ preferences_dir }}/{{ pref_file }}: | ||
file.managed: | ||
- mode: '0644' | ||
- user: root | ||
- group: root | ||
- contents: | ||
- "{{ 'Package: ' ~ p_package }}" | ||
- "{{ 'Pin: ' ~ args.pin }}" | ||
- "{{ 'Pin-Priority: ' ~ args.priority }}" | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
test/integration/preferences/serverspec/preferences_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require_relative '../../../kitchen/data/spec_helper' | ||
|
||
describe 'apt.preferences' do | ||
|
||
describe file('/etc/apt/preferences') do | ||
it { should_not exist } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d') do | ||
it { should be_directory } | ||
it { should be_mode 755 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/00-rspamd') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its(:content) { should match("Package: rspamd\nPin: origin rspamd.com\nPin-Priority: 650\n") } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/01-all') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its(:content) { should match("Package: *\nPin: release stable\nPin-Priority: 610\n") } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/02-all') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its(:content) { should match("Package: *\nPin: release testing\nPin-Priority: 600\n") } | ||
end | ||
|
||
describe file('/etc/apt/preferences.d/03-all') do | ||
it { should exist } | ||
it { should be_mode 644 } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its(:content) { should match("Package: *\nPin: release unstable\nPin-Priority: 50\n") } | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require 'spec_helper' | ||
require_relative '../../../kitchen/data/spec_helper' | ||
|
||
describe 'apt.repositories' do | ||
|
||
|
File renamed without changes.