$sources = undef,
) inherits ::apt::params {
- if $::osfamily != 'Debian' {
- fail('This module only works on Debian or derivatives like Ubuntu')
- }
-
include apt::update
$frequency_options = ['always','daily','weekly','reluctantly']
$apt_conf_d = "${root}/apt.conf.d"
$preferences_d = "${root}/preferences.d"
+ if $::osfamily != 'Debian' {
+ fail('This module only works on Debian or derivatives like Ubuntu')
+ }
+
case $::lsbdistid {
'ubuntu', 'debian': {
$distid = $::lsbdistid
'recurse' => false,
})}
- it { should contain_file('01proxy').that_notifies('Exec[apt_update]').only_with({
- 'ensure' => 'absent',
- 'path' => '/etc/apt/apt.conf.d/01proxy',
- 'notify' => 'Exec[apt_update]',
- })}
-
it 'should lay down /etc/apt/apt.conf.d/15update-stamp' do
should contain_file('/etc/apt/apt.conf.d/15update-stamp').with({
'group' => 'root',
}).with_content(/APT::Update::Post-Invoke-Success \{"touch \/var\/lib\/apt\/periodic\/update-success-stamp 2>\/dev\/null \|\| true";\};/)
end
- it { should contain_file('old-proxy-file').that_notifies('Exec[apt_update]').only_with({
- 'ensure' => 'absent',
- 'path' => '/etc/apt/apt.conf.d/proxy',
- 'notify' => 'Exec[apt_update]',
- })}
-
it { should contain_exec('apt_update').with({
'refreshonly' => 'true',
})}
let :params do
{
:always_apt_update => true,
- :disable_keys => true,
- :proxy_host => 'foo',
- :proxy_port => '9876',
:purge_sources_list => true,
:purge_sources_list_d => true,
:purge_preferences => true,
:purge_preferences_d => true,
:update_timeout => '1',
:update_tries => '3',
- :fancy_progress => true,
}
end
'recurse' => 'true',
})}
- it { should contain_file('99progressbar').only_with({
- 'ensure' => 'present',
- 'content' => /Dpkg::Progress-Fancy "1";/,
- 'path' => '/etc/apt/apt.conf.d/99progressbar',
- })}
-
- it { should contain_file('99unauth').only_with({
- 'ensure' => 'present',
- 'content' => /APT::Get::AllowUnauthenticated 1;/,
- 'path' => '/etc/apt/apt.conf.d/99unauth',
- })}
-
- it { should contain_file('01proxy').that_notifies('Exec[apt_update]').only_with({
- 'ensure' => 'present',
- 'path' => '/etc/apt/apt.conf.d/01proxy',
- 'content' => /Acquire::http::Proxy "http:\/\/foo:9876";/,
- 'notify' => 'Exec[apt_update]',
- 'mode' => '0644',
- 'owner' => 'root',
- 'group' => 'root'
- })}
-
it { should contain_exec('apt_update').with({
'refreshonly' => 'false',
'timeout' => '1',
end
- context 'more non-default' do
- let :params do
- {
- :fancy_progress => false,
- :disable_keys => false,
- }
- end
-
- it { should contain_file('99progressbar').only_with({
- 'ensure' => 'absent',
- 'path' => '/etc/apt/apt.conf.d/99progressbar',
- })}
-
- it { should contain_file('99unauth').only_with({
- 'ensure' => 'absent',
- 'path' => '/etc/apt/apt.conf.d/99unauth',
- })}
-
- end
-
context 'with sources defined on valid osfamily' do
let :facts do
{ :osfamily => 'Debian',
describe "With unknown lsbdistid" do
- let(:facts) { { :lsbdistid => 'CentOS' } }
+ let(:facts) { { :lsbdistid => 'CentOS', :osfamily => 'Debian' } }
let (:title) { 'my_package' }
it do
end
describe "With lsb-release not installed" do
- let(:facts) { { :lsbdistid => '' } }
+ let(:facts) { { :lsbdistid => '', :osfamily => 'Debian' } }
let (:title) { 'my_package' }
it do
require 'spec_helper'
describe 'apt::release', :type => :class do
- let(:facts) { { :lsbdistid => 'Debian' } }
+ let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
let (:title) { 'my_package' }
let :param_set do
describe 'apt::unattended_upgrades', :type => :class do
let(:file_unattended) { '/etc/apt/apt.conf.d/50unattended-upgrades' }
let(:file_periodic) { '/etc/apt/apt.conf.d/10periodic' }
- let(:facts) { { :lsbdistid => 'Debian' } }
+ let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
it { should contain_package("unattended-upgrades") }
{
'lsbdistid' => 'debian',
'lsbdistcodename' => 'squeeze',
+ 'osfamily' => 'Debian',
}
end
context 'bad auto_fix' do
{
'lsbdistid' => 'debian',
'lsbdistcodename' => 'squeeze',
+ 'osfamily' => 'Debian',
}
end
{
'lsbdistid' => 'debian',
'lsbdistcodename' => 'wheezy',
+ 'osfamily' => 'Debian',
}
end
{
'lsbdistid' => 'debian',
'lsbdistcodename' => 'wheezy',
+ 'osfamily' => 'Debian',
}
end
require 'spec_helper'
describe 'apt::conf', :type => :define do
- let(:facts) { { :lsbdistid => 'Debian' } }
+ let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
let :title do
'norecommends'
end
require 'spec_helper'
describe 'apt::force', :type => :define do
- let(:facts) { { :lsbdistid => 'Debian' } }
+ let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
let :pre_condition do
'include apt::params'
end
require 'spec_helper'
describe 'apt::key', :type => :define do
- let(:facts) { { :lsbdistid => 'Debian' } }
+ let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30'
let :title do
require 'spec_helper'
describe 'apt::pin', :type => :define do
- let(:facts) { { :lsbdistid => 'Debian' } }
+ let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
let(:title) { 'my_pin' }
context 'defaults' do
}
end
- describe 'apt included, proxy' do
- let :pre_condition do
- 'class { "apt": proxy_host => "example.com" }'
- end
- let :facts do
- {
- :lsbdistrelease => '14.04',
- :lsbdistcodename => 'trusty',
- :operatingsystem => 'Ubuntu',
- :lsbdistid => 'Ubuntu',
- :osfamily => 'Debian',
- }
- end
- let :params do
- {
- 'release' => 'lucid',
- }
- end
- let(:title) { 'ppa:foo' }
- it { is_expected.to contain_package('software-properties-common') }
- it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Exec[apt_update]').with({
- 'environment' => ['http_proxy=http://example.com:8080', 'https_proxy=http://example.com:8080'],
- 'command' => '/usr/bin/add-apt-repository -y ppa:foo',
- 'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/foo-lucid.list',
- 'user' => 'root',
- 'logoutput' => 'on_failure',
- })
- }
-
- it { is_expected.to contain_file('/etc/apt/sources.list.d/foo-lucid.list').that_requires('Exec[add-apt-repository-ppa:foo]').with({
- 'ensure' => 'file',
- })
- }
- end
-
describe 'ensure absent' do
let :facts do
{