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

Add apt::key_options for default apt::key options #873

Merged
merged 3 commits into from
Aug 14, 2019
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: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://, or
# hkp://).
#
# @param key_options
# Specifies the default options for apt::key resources.
#
# @param ppa_options
# Supplies options to be passed to the `add-apt-repository` command.
#
Expand Down Expand Up @@ -122,6 +125,7 @@
Hash $include_defaults = $apt::params::include_defaults,
String $provider = $apt::params::provider,
String $keyserver = $apt::params::keyserver,
Optional[String] $key_options = $apt::params::key_options,
Optional[String] $ppa_options = $apt::params::ppa_options,
Optional[String] $ppa_package = $apt::params::ppa_package,
Optional[Hash] $backports = $apt::params::backports,
Expand Down
2 changes: 1 addition & 1 deletion manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $source = undef,
Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/] $server = $::apt::keyserver,
Boolean $weak_ssl = false,
Optional[String] $options = undef,
Optional[String] $options = $::apt::key_options,
) {

case $ensure {
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$preferences = "${root}/preferences"
$preferences_d = "${root}/preferences.d"
$keyserver = 'keyserver.ubuntu.com'
$key_options = undef
$confs = {}
$update = {}
$purge = {}
Expand Down
26 changes: 26 additions & 0 deletions spec/defines/key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,30 @@ def absent_apt_key(title)
end
end
end

describe 'defaults' do
context 'when setting keyserver on the apt class' do
let :pre_condition do
'class { "apt":
keyserver => "keyserver.example.com",
}'
end

it 'uses default keyserver' do
is_expected.to contain_apt_key(title).with_server('keyserver.example.com')
end
end

context 'when setting key_options on the apt class' do
let :pre_condition do
'class { "apt":
key_options => "http-proxy=http://proxy.example.com:8080",
}'
end

it 'uses default keyserver' do
is_expected.to contain_apt_key(title).with_options('http-proxy=http://proxy.example.com:8080')
end
end
end
end