From: TP Honey Date: Tue, 12 Apr 2016 09:46:39 +0000 (+0100) Subject: Merge pull request #596 from danielhoherd/master X-Git-Tag: 2.3.0~20 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=015009d5530576136e5a5432e672125da0881d39;hp=c04cd01290d8539ee284babf443845d5db65ca26;p=puppet-modules%2Fpuppetlabs-apt.git Merge pull request #596 from danielhoherd/master Expose notify_update to apt::source --- diff --git a/README.md b/README.md index 30dfed2..49266cc 100644 --- a/README.md +++ b/README.md @@ -485,6 +485,8 @@ Manages the Apt sources in `/etc/apt/sources.list.d/`. * `trusted_source`: Specifies whether to authenticate packages from this release, even if the Release file is not signed or the signature can't be checked. Valid options: 'true' and 'false'. Default: undef. This parameter is **deprecated** and will be removed in a future version of the module. +* `notify_update`: *Optional.* Specifies whether to trigger an `apt-get update` run. Valid options: 'true' and 'false'. Default: 'true'. + #### Type: `apt_key` Manages the GPG keys that Apt uses to authenticate packages. diff --git a/manifests/source.pp b/manifests/source.pp index 1307a3a..0bb9b3b 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -18,6 +18,7 @@ define apt::source( $key_content = undef, $key_source = undef, $trusted_source = undef, + $notify_update = undef, ) { validate_string($architecture, $comment, $location, $repos) validate_bool($allow_unsigned) @@ -114,8 +115,9 @@ define apt::source( } apt::setting { "list-${name}": - ensure => $ensure, - content => template('apt/_header.erb', 'apt/source.list.erb'), + ensure => $ensure, + content => template('apt/_header.erb', 'apt/source.list.erb'), + notify_update => $notify_update, } if $pin { diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index cfae55c..4c3321a 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -387,5 +387,58 @@ describe 'apt::source' do end end + context "with notify_update = undef (default)" do + let :facts do + { + :lsbdistid => 'Debian', + :lsbdistcodename => 'wheezy', + :osfamily => 'Debian', + :puppetversion => Puppet.version, + } + end + let :params do + { + :location => 'hello.there', + } + end + it { is_expected.to contain_apt__setting("list-#{title}").with_notify_update(true) } + end + + context "with notify_update = true" do + let :facts do + { + :lsbdistid => 'Debian', + :lsbdistcodename => 'wheezy', + :osfamily => 'Debian', + :puppetversion => Puppet.version, + } + end + let :params do + { + :location => 'hello.there', + :notify_update => true, + } + end + it { is_expected.to contain_apt__setting("list-#{title}").with_notify_update(true) } + end + + context "with notify_update = false" do + let :facts do + { + :lsbdistid => 'Debian', + :lsbdistcodename => 'wheezy', + :osfamily => 'Debian', + :puppetversion => Puppet.version, + } + end + let :params do + { + :location => 'hello.there', + :notify_update => false, + } + end + it { is_expected.to contain_apt__setting("list-#{title}").with_notify_update(false) } + end + end end