Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose notify_update to apt::conf #551

Merged
merged 1 commit into from
Aug 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ Specifies a custom Apt configuration file.

* `priority`: *Optional.* Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first. Valid options: a string containing an integer. Default: '50'.

* `notify_update`: *Optional.* Specifies whether to trigger an `apt-get update` run. Valid options: 'true' and 'false'. Default: 'true'.

#### Define: `apt::key`

Manages the GPG keys that Apt uses to authenticate packages.
Expand Down Expand Up @@ -323,7 +325,7 @@ The `apt::key` define makes use of the `apt_key` type, but includes extra functi

#### Define: `apt::pin`

Manages Apt pins.
Manages Apt pins. Does not trigger an `apt-get update` run.

**Note:** For context on these parameters, we recommend reading the man page ['apt_preferences(5)'](http://linux.die.net/man/5/apt_preferences)

Expand Down
14 changes: 8 additions & 6 deletions manifests/conf.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
define apt::conf (
$content = undef,
$ensure = present,
$priority = '50',
$content = undef,
$ensure = present,
$priority = '50',
$notify_update = undef,
) {

unless $ensure == 'absent' {
Expand All @@ -11,8 +12,9 @@
}

apt::setting { "conf-${name}":
ensure => $ensure,
priority => $priority,
content => template('apt/_conf_header.erb', 'apt/conf.erb'),
ensure => $ensure,
priority => $priority,
content => template('apt/_conf_header.erb', 'apt/conf.erb'),
notify_update => $notify_update,
}
}
7 changes: 4 additions & 3 deletions manifests/pin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@
$file_name = regsubst($title, '[^0-9a-z\-_\.]', '_', 'IG')

apt::setting { "pref-${file_name}":
ensure => $ensure,
priority => $order,
content => template('apt/_header.erb', 'apt/pin.pref.erb'),
ensure => $ensure,
priority => $order,
content => template('apt/_header.erb', 'apt/pin.pref.erb'),
notify_update => false,
}
}
21 changes: 20 additions & 1 deletion spec/defines/conf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
end

describe "when creating an apt preference" do
let :params do
let :default_params do
{
:priority => '00',
:content => "Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;\n"
}
end
let :params do
default_params
end

let :filename do
"/etc/apt/apt.conf.d/00norecommends"
Expand All @@ -28,6 +31,22 @@
'mode' => '0644',
})
}

context "with notify_update = true (default)" do
let :params do
default_params
end
it { is_expected.to contain_apt__setting("conf-#{title}").with_notify_update(true) }
end

context "with notify_update = false" do
let :params do
default_params.merge({
:notify_update => false
})
end
it { is_expected.to contain_apt__setting("conf-#{title}").with_notify_update(false) }
end
end

describe "when creating a preference without content" do
Expand Down