Skip to content

Commit

Permalink
(MODULES-1156, MODULES-769) Remove unnecessary anchors
Browse files Browse the repository at this point in the history
`apt::ppa` and `apt::setting` don't actually include `apt::update` so
anchors are unnecessary. Move `apt` to use contain instead of anchors,
since it wasn't anchoring properly anyways. Update the tests to make
sure it can have settings and ppas depending on each other without
cycles.
  • Loading branch information
Morgan Haskel committed Mar 24, 2015
1 parent 794c758 commit 911c4de
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
5 changes: 1 addition & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@
notify => Exec['apt_update'],
}

# Need anchor to provide containment for dependencies.
anchor { 'apt::update':
require => Class['apt::update'],
}
contain 'apt::update'

# manage sources if present
if $sources {
Expand Down
5 changes: 0 additions & 5 deletions manifests/ppa.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,4 @@
notify => Exec['apt_update'],
}
}

# Need anchor to provide containment for dependencies.
anchor { "apt::ppa::${name}":
require => Class['apt::update'],
}
}
6 changes: 0 additions & 6 deletions manifests/setting.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,4 @@
source => $source,
notify => $_notify,
}

if $notify_update {
anchor { "apt::setting::${name}":
require => Class['apt::update']
}
}
}
14 changes: 12 additions & 2 deletions spec/defines/ppa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@
}
end

describe 'apt included, no proxy' do
describe 'ppa depending on ppa, MODULES-1156' do
let :pre_condition do
'class { "apt": }'
end
end

describe 'apt included, no proxy' do
let :pre_condition do
'class { "apt": }
apt::ppa { "ppa:foo2": }
'
end
let :facts do
{
:lsbdistrelease => '14.04',
Expand All @@ -42,11 +50,13 @@
end
let :params do
{
:options => '',
:options => '',
:package_manage => true,
:require => 'Apt::Ppa[ppa:foo2]',
}
end
let(:title) { 'ppa:foo' }
it { is_expected.to compile.with_all_deps }
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 => [],
Expand Down
15 changes: 15 additions & 0 deletions spec/defines/setting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@
end
end

describe 'settings requiring settings, MODULES-769' do
let(:pre_condition) do
'class { "apt": }
apt::setting { "list-teddybear": content => "foo" }
'
end
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy' } }
let(:title) { 'conf-teddybear' }
let(:default_params) { { :content => 'di' } }

let(:params) { default_params.merge({ :require => 'Apt::Setting[list-teddybear]' }) }

it { is_expected.to compile.with_all_deps }
end

describe 'when trying to pull one over' do
context 'with source and content' do
let(:params) { default_params.merge({ :source => 'la' }) }
Expand Down

0 comments on commit 911c4de

Please sign in to comment.