MODULES-2873 - Avoid duplicate package resources when package_manage => true
This commit is contained in:
parent
5e6ba08f21
commit
08c8b58264
2 changed files with 41 additions and 1 deletions
|
@ -22,7 +22,7 @@ define apt::ppa(
|
|||
|
||||
if $ensure == 'present' {
|
||||
if $package_manage {
|
||||
package { $package_name: }
|
||||
ensure_packages($package_name)
|
||||
|
||||
$_require = [File['sources.list.d'], Package[$package_name]]
|
||||
} else {
|
||||
|
|
|
@ -72,6 +72,46 @@ describe 'apt::ppa' do
|
|||
}
|
||||
end
|
||||
|
||||
describe 'package_manage => true, multiple ppas, MODULES-2873' do
|
||||
let :pre_condition do
|
||||
'class { "apt": }
|
||||
apt::ppa {"ppa:foo":
|
||||
package_manage => true
|
||||
}'
|
||||
end
|
||||
let :facts do
|
||||
{
|
||||
:lsbdistrelease => '11.04',
|
||||
:lsbdistcodename => 'natty',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:lsbdistid => 'Ubuntu',
|
||||
:puppetversion => Puppet.version,
|
||||
}
|
||||
end
|
||||
let :params do
|
||||
{
|
||||
:package_manage => true,
|
||||
}
|
||||
end
|
||||
|
||||
let(:title) { 'ppa:bar' }
|
||||
it { is_expected.to contain_package('python-software-properties') }
|
||||
it { is_expected.to contain_exec('add-apt-repository-ppa:bar').that_notifies('Class[Apt::Update]').with({
|
||||
'environment' => [],
|
||||
'command' => '/usr/bin/add-apt-repository -y ppa:bar',
|
||||
'unless' => '/usr/bin/test -s /etc/apt/sources.list.d/bar-natty.list',
|
||||
'user' => 'root',
|
||||
'logoutput' => 'on_failure',
|
||||
})
|
||||
}
|
||||
|
||||
it { is_expected.to contain_file('/etc/apt/sources.list.d/bar-natty.list').that_requires('Exec[add-apt-repository-ppa:bar]').with({
|
||||
'ensure' => 'file',
|
||||
})
|
||||
}
|
||||
end
|
||||
|
||||
describe 'package_manage => false' do
|
||||
let :pre_condition do
|
||||
'class { "apt": }'
|
||||
|
|
Loading…
Reference in a new issue