Merge pull request #588 from werekraken/modules2873
MODULES-2873 - Avoid multiple package resource declarations
This commit is contained in:
commit
ddd05418ae
2 changed files with 41 additions and 1 deletions
|
@ -22,7 +22,7 @@ define apt::ppa(
|
||||||
|
|
||||||
if $ensure == 'present' {
|
if $ensure == 'present' {
|
||||||
if $package_manage {
|
if $package_manage {
|
||||||
package { $package_name: }
|
ensure_packages($package_name)
|
||||||
|
|
||||||
$_require = [File['sources.list.d'], Package[$package_name]]
|
$_require = [File['sources.list.d'], Package[$package_name]]
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -72,6 +72,46 @@ describe 'apt::ppa' do
|
||||||
}
|
}
|
||||||
end
|
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
|
describe 'package_manage => false' do
|
||||||
let :pre_condition do
|
let :pre_condition do
|
||||||
'class { "apt": }'
|
'class { "apt": }'
|
||||||
|
|
Loading…
Reference in a new issue