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

(CONT-1028) puppetlabs/stdlib: Allow 9.x #1113

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
18 changes: 7 additions & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
assert_type(Integer, $update['tries'])
}

$_update = merge($apt::update_defaults, $update)
$_update = $apt::update_defaults + $update
include apt::update

if $purge['sources.list'] {
Expand All @@ -222,11 +222,11 @@
assert_type(Boolean, $purge['apt.conf.d'])
}

$_purge = merge($apt::purge_defaults, $purge)
$_purge = $apt::purge_defaults + $purge

if $proxy['perhost'] {
$_perhost = $proxy['perhost'].map |$item| {
$_item = merge($apt::proxy_defaults, $item)
$_item = $apt::proxy_defaults + $item
$_scheme = $_item['https'] ? {
true => 'https',
default => 'http',
Expand All @@ -239,17 +239,13 @@
true => 'DIRECT',
default => "${_scheme}://${_item['host']}${_port}/",
}
merge($item, {
'scheme' => $_scheme,
'target' => $_target,
}
)
$item + { 'scheme' => $_scheme, 'target' => $_target, }
}
} else {
$_perhost = {}
}

$_proxy = merge($apt::proxy_defaults, $proxy, { 'perhost' => $_perhost })
$_proxy = $apt::proxy_defaults + $proxy + { 'perhost' => $_perhost }

$confheadertmp = epp('apt/_conf_header.epp')
$proxytmp = epp('apt/proxy.epp', { 'proxies' => $_proxy })
Expand Down Expand Up @@ -386,12 +382,12 @@
case $facts['os']['name'] {
'Debian': {
if versioncmp($facts['os']['release']['major'], '9') >= 0 {
ensure_packages(['gnupg'])
stdlib::ensure_packages(['gnupg'])
}
}
'Ubuntu': {
if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
ensure_packages(['gnupg'])
stdlib::ensure_packages(['gnupg'])
}
}
default: {
Expand Down
4 changes: 2 additions & 2 deletions manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@
case $facts['os']['name'] {
'Debian': {
if versioncmp($facts['os']['release']['major'], '9') >= 0 {
ensure_packages(['gnupg'])
stdlib::ensure_packages(['gnupg'])
Apt::Key<| title == $title |>
}
}
'Ubuntu': {
if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
ensure_packages(['gnupg'])
stdlib::ensure_packages(['gnupg'])
Apt::Key<| title == $title |>
}
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/ppa.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

if $ensure == 'present' {
if $package_manage {
ensure_packages($package_name)
stdlib::ensure_packages($package_name)
$_require = [File['sources.list.d'], Package[$package_name]]
} else {
$_require = File['sources.list.d']
Expand Down
8 changes: 4 additions & 4 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@
# Newer oses, do not need the package for HTTPS transport.
$_transport_https_releases = ['9']
if (fact('os.release.major') in $_transport_https_releases) and $_location =~ /(?i:^https:\/\/)/ {
ensure_packages('apt-transport-https')
stdlib::ensure_packages('apt-transport-https')
Package['apt-transport-https'] -> Class['apt::update']
}
} else {
$_location = undef
}

$includes = merge($apt::include_defaults, $include)
$includes = $apt::include_defaults + $include

if $key and $keyring {
fail('parameters key and keyring are mutualy exclusive')
Expand All @@ -125,7 +125,7 @@
unless $key['id'] {
fail('key hash must contain at least an id entry')
}
$_key = merge($apt::source_key_defaults, $key)
$_key = $apt::source_key_defaults + $key
} else {
$_key = { 'id' => assert_type(String[1], $key) }
}
Expand Down Expand Up @@ -164,7 +164,7 @@

if $pin {
if $pin =~ Hash {
$_pin = merge($pin, { 'ensure' => $ensure, 'before' => $_before })
$_pin = $pin + { 'ensure' => $ensure, 'before' => $_before }
} elsif ($pin =~ Numeric or $pin =~ String) {
$url_split = split($location, '[:\/]+')
$host = $url_split[1]
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.16.0 < 9.0.0"
"version_requirement": ">= 4.16.0 < 10.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, stdlib::ensure_packages appeared in 9.0.0 (where merge is also available as stdlib::merge). Not sure if we should bump the minimum version to 9.0.0 or rather use the deprecated functions.

Copy link
Collaborator Author

@bastelfreak bastelfreak Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to do it now and rip out all the legacy function calls. Otherwise we need to touch the codebase in the future again.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK! I opened #1114 to update the minimum version requirement.

}
],
"operatingsystem_support": [
Expand Down