fail('lsbdistcodename fact not available: release parameter required')
}
- file { "${name}.list":
- ensure => $ensure,
- path => "${::apt::sources_list_d}/${name}.list",
- owner => root,
- group => root,
- mode => '0644',
- content => template('apt/_header.erb', 'apt/source.list.erb'),
- notify => Exec['apt_update'],
+ apt::setting { $name:
+ ensure => $ensure,
+ setting_type => 'list',
+ content => template('apt/_header.erb', 'apt/source.list.erb'),
+ notify => Exec['apt_update'],
}
-
if ($pin != false) {
# Get the host portion out of the url so we can pin to origin
$url_split = split($location, '/')
apt::pin { $name:
ensure => $ensure,
priority => $pin,
- before => File["${name}.list"],
+ before => Apt::Setting[$name],
origin => $host,
}
}
key_server => $key_server,
key_content => $key_content,
key_source => $key_source,
- before => File["${name}.list"],
+ before => Apt::Setting[$name],
}
}
} } }
it {
- should contain_file('debian_unstable.list').with({
+ should contain_apt__setting('debian_unstable').with({
'ensure' => 'present',
- 'path' => '/etc/apt/sources.list.d/debian_unstable.list',
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
'notify' => 'Exec[apt_update]',
})
}
- it { should contain_file('debian_unstable.list').with_content(/^deb http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
- it { should contain_file('debian_unstable.list').with_content(/^deb-src http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
+ it { should contain_file('/etc/apt/sources.list.d/debian_unstable.list').with_content(/^deb http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
+ it { should contain_file('/etc/apt/sources.list.d/debian_unstable.list').with_content(/^deb-src http:\/\/debian.mirror.iweb.ca\/debian\/ unstable main contrib non-free$/) }
it {
- should contain_file('puppetlabs.list').with({
+ should contain_apt__setting('puppetlabs').with({
'ensure' => 'present',
- 'path' => '/etc/apt/sources.list.d/puppetlabs.list',
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
'notify' => 'Exec[apt_update]',
})
}
- it { should contain_file('puppetlabs.list').with_content(/^deb http:\/\/apt.puppetlabs.com precise main$/) }
+ it { should contain_file('/etc/apt/sources.list.d/puppetlabs.list').with_content(/^deb http:\/\/apt.puppetlabs.com precise main$/) }
end
describe 'failing tests' do
}
end
- it { is_expected.to contain_file('my_source.list').that_notifies('Exec[apt_update]').with({
+ it { is_expected.to contain_apt__setting('my_source').that_notifies('Exec[apt_update]').with({
'ensure' => 'present',
- 'path' => '/etc/apt/sources.list.d/my_source.list',
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
}).with_content(/# my_source\ndeb-src wheezy main\n/)
}
end
}
end
- it { is_expected.to contain_file('my_source.list').that_notifies('Exec[apt_update]').with({
+ it { is_expected.to contain_apt__setting('my_source').that_notifies('Exec[apt_update]').with({
'ensure' => 'present',
- 'path' => '/etc/apt/sources.list.d/my_source.list',
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
}).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
}
- it { is_expected.to contain_apt__pin('my_source').that_comes_before('File[my_source.list]').with({
+ it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[my_source]').with({
'ensure' => 'present',
'priority' => '10',
'origin' => 'debian.mirror.iweb.ca',
})
}
- it { is_expected.to contain_apt__key("Add key: #{GPG_KEY_ID} from Apt::Source my_source").that_comes_before('File[my_source.list]').with({
+ it { is_expected.to contain_apt__key("Add key: #{GPG_KEY_ID} from Apt::Source my_source").that_comes_before('Apt::Setting[my_source]').with({
'ensure' => 'present',
'key' => GPG_KEY_ID,
'key_server' => 'pgp.mit.edu',
}
end
- it { is_expected.to contain_file('my_source.list').that_notifies('Exec[apt_update]').with({
+ it { is_expected.to contain_apt__setting('my_source').that_notifies('Exec[apt_update]').with({
'ensure' => 'present',
- 'path' => '/etc/apt/sources.list.d/my_source.list',
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
}).with_content(/# my_source\ndeb \[trusted=yes\] wheezy main\n/)
}
end
}
end
- it { is_expected.to contain_file('my_source.list').that_notifies('Exec[apt_update]').with({
+ it { is_expected.to contain_apt__setting('my_source').that_notifies('Exec[apt_update]').with({
'ensure' => 'present',
- 'path' => '/etc/apt/sources.list.d/my_source.list',
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => '0644',
}).with_content(/# my_source\ndeb-src \[arch=x86_64 \] wheezy main\n/)
}
end
}
end
- it { is_expected.to contain_file('my_source.list').that_notifies('Exec[apt_update]').with({
+ it { is_expected.to contain_apt__setting('my_source').that_notifies('Exec[apt_update]').with({
'ensure' => 'absent'
})
}