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

replace legacy is_array/is_string with native datatype checks #4

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 5 additions & 13 deletions manifests/mirror.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Default: []
define aptly::mirror (
String $location,
Variant[String, Hash] $key = {},
Variant[String[1], Hash[String[1],Variant[Integer[1],String[1]]]] $key = {},
String $keyring = '/etc/apt/trusted.gpg',
String $filter = '',
String $release = $::lsbdistcodename,
Expand Down Expand Up @@ -100,12 +100,10 @@
# $::aptly::key_server will be used as default key server
# key in hash format
if $key =~ Hash and $key[id] {
if is_array($key[id]) {
if $key[id] =~ Array {
$key_string = join($key[id], "' '")
} elsif is_string($key[id]) or is_integer($key[id]) {
$key_string = $key[id]
} else {
fail('$key[id] is neither a string nor an array!')
$key_string = $key[id]
}
if $key[server] {
$key_server = $key[server]
Expand All @@ -114,15 +112,9 @@
}

# key in string/array format
}elsif is_string($key) or is_array($key) {
} elsif $key =~ String {
$key_server = $::aptly::key_server
if is_array($key) {
$key_string = join($key, "' '")
} elsif is_string($key) or is_integer($key) {
$key_string = $key
} else {
fail('$key is neither a string nor an array!')
}
$key_string = $key
}

# no GPG key
Expand Down