-
Notifications
You must be signed in to change notification settings - Fork 567
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
Support puppetlabs/apt 10.x; require >= 9.2 #1116
Conversation
manifests/repo/debian.pp
Outdated
@@ -16,7 +16,7 @@ | |||
apt::source { 'jenkins': | |||
location => $location, | |||
release => 'binary/', | |||
repos => '', | |||
repos => undef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is undef, can't we simply leave it out?
repos => undef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In either case, that would result in main
being used?? (The module default). I'm guessing this isn't the intention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the intention is to get an empty string in the generated file. Won't an explicit undef do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so. I think you'll just get the module's default which is the string 'main'
. I'm not familiar with the workings of the module though as I use Puppet mainly on RPM based systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, undef
means "use whatever is defined" elsewhere I think. So it ends up being main
.
manifests/repo/debian.pp
Outdated
@@ -16,7 +16,7 @@ | |||
apt::source { 'jenkins': | |||
location => $location, | |||
release => 'binary/', | |||
repos => '', | |||
repos => undef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think undef
is allowed.
https://github.com/puppetlabs/puppetlabs-apt/blob/966d39cfe2cd85a5b481e67e8da51e2024b336d2/manifests/source.pp#L111
Maybe an empty array instead??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK undef
is always allowed. It just means it ends up using the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I wonder if an array works: https://github.com/puppetlabs/puppetlabs-apt/pull/1167/files#r1904058136
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not use the default, no.
# cat lol.pp
$location = 'https://pkg.jenkins.io/debian-stable'
$gpg_key_id = '63667EE74BBA1F0A08A698725BA31D57EF5975CA'
apt::source { 'jenkins':
location => $location,
release => 'binary/',
repos => undef,
include => {
'src' => false,
},
key => {
'id' => $gpg_key_id,
'source' => "${location}/jenkins.io-2023.key",
},
}
# puppet apply lol.pp
Notice: Compiled catalog for eb3b185efcfa.redhat.com in environment production in 0.10 seconds
Notice: /Stage[main]/Apt/File[sources.list]/ensure: created
Notice: /Stage[main]/Apt/File[preferences]/ensure: created
Notice: /Stage[main]/Apt/Package[gnupg]/ensure: created
Notice: /Stage[main]/Apt/Apt::Setting[conf-update-stamp]/File[/etc/apt/apt.conf.d/15update-stamp]/ensure: defined content as '{sha256}2e6eb1f5f20262bfc6b7dfb26a302f00b4ab5fee803abd9e07ad8378cce067d5'
Notice: /Stage[main]/Main/Apt::Source[jenkins]/Apt::Key[Add key: 63667EE74BBA1F0A08A698725BA31D57EF5975CA from Apt::Source jenkins]/Apt_key[Add key: 63667EE74BBA1F0A08A698725BA31D57EF5975CA from Apt::Source jenkins]/ensure: created
Notice: /Stage[main]/Main/Apt::Source[jenkins]/Apt::Setting[list-jenkins]/File[/etc/apt/sources.list.d/jenkins.list]/ensure: defined content as '{sha256}f853a9845679b71b1e95e04d20508cabc490f9ba393274037bda37f87429408a'
Notice: /Stage[main]/Apt::Update/Exec[apt_update]: Triggered 'refresh' from 1 event
Notice: Applied catalog in 4.54 seconds
# cat /etc/apt/sources.list.d/jenkins.list
# This file is managed by Puppet. DO NOT EDIT.
# jenkins
deb https://pkg.jenkins.io/debian-stable binary/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might, but you're probably hitting this code: https://github.com/puppetlabs/puppetlabs-apt/blob/966d39cfe2cd85a5b481e67e8da51e2024b336d2/manifests/source.pp#L140-L144
Note release
is binary/
so $_components
is just $_release
, not ${_release} ${repos}
. I expect that if you change release
to binary
you will see it as deb https://pkg.jenkins.io/debian-stable binary main
.
If not, it would violate the type Variant[String[1], Array[String[1]]]
which doesn't allow undef
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Yes indeed.
WHY IS THERE SO MUCH MAGIC?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but I still think we should leave it out
repos => undef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Requires puppetlabs/puppetlabs-apt@ce8e484 tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bleh. I submitted puppetlabs/puppetlabs-apt#1215 so you can also use repos => []
which IMHO is cleaner since it's explicit, but I think only requiring 9.x as the lower bound is probably better.
Linking a related PR that attempts to do the same: #1116. |
As shown in #1115, this works "as intended" (but yes, I don't like that api change in puppetlabs/apt either). |
This uses the new logic introduced in 9.2.0 [1] and thus bumps the lower bound. [1] puppetlabs/puppetlabs-apt@ce8e484
Pull Request (PR) description
This Pull Request (PR) fixes the following issues