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

Shorten the conditionals in apt::source #1214

Merged
merged 1 commit into from
Jan 6, 2025
Merged
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
28 changes: 10 additions & 18 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,10 @@
fail('cannot create a source entry without specifying a location')
}
}
if (type($location, 'generalized') !~ Type[Array]) {
if $location !~ Array {
warning('For deb822 sources, location must be specified as an array.')
$_location = [$location]
}
else {
} else {
$_location = $location
}

Expand All @@ -302,30 +301,23 @@
} else {
fail('os.distro.codename fact not available: release parameter required')
}
} elsif $release !~ Array {
warning("For deb822 sources, 'release' must be specified as an array. Converting to array.")
$_release = [$release]
} else {
if (type($release, 'generalized') !~ Type[Array]) {
warning("For deb822 sources, 'release' must be specified as an array. Converting to array.")
$_release = [$release]
} else {
$_release = $release
}
$_release = $release
}

if (type($repos, 'generalized') !~ Type[Array]) {
if $repos !~ Array {
warning("For deb822 sources, 'repos' must be specified as an array. Converting to array.")
$_repos = split($repos, /\s+/)
} else {
$_repos = $repos
}

if $architecture != undef {
if (type($architecture, 'generalized') !~ Type[Array]) {
warning("For deb822 sources, 'architecture' must be specified as an array. Converting to array.")
$_architecture = split($architecture, '[,]')
}
else {
$_architecture = $architecture
}
if $architecture and $architecture !~ Array {
warning("For deb822 sources, 'architecture' must be specified as an array. Converting to array.")
$_architecture = split($architecture, '[,]')
} else {
$_architecture = $architecture
}
Expand Down
Loading