Closed maturnbull closed 2 years ago
Puppetfiles
.These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.
Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.
Hello @maturnbull, this looks good ! Thank you for your contribution!
It looks like this change breaks the module when you don't have a proxy set:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Method call, The function 'each' was called with arguments it does not accept. It expects one of:
(Hash hash, Callable[2, 2] block)
rejected: parameter 'hash' expects a Hash value, got Undef
(Hash hash, Callable[1, 1] block)
rejected: parameter 'hash' expects a Hash value, got Undef
(Iterable enumerable, Callable[2, 2] block)
rejected: parameter 'enumerable' expects an Iterable value, got Undef
(Iterable enumerable, Callable[1, 1] block)
rejected: parameter 'enumerable' expects an Iterable value, got Undef (file: /etc/puppetlabs/code/environments/testing/modules/apt/templates/proxy.epp, line: 2, column: 23)
@lamaral I can't reproduce the problem you're seeing - please can you share more details of the Hiera files and how you're testing? I've tried both with the entire perhost:
structure missing, and also with an empty perhost:
I don't have any apt setup done via Hiera.
I have a couple different repositories declared like this in classes:
apt::source { 'docker':
location => 'https://download.docker.com/linux/debian',
repos => 'stable',
key => {
id => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
source => 'https://download.docker.com/linux/debian/gpg',
},
}
I have no proxy at all configured for them.
After downgrading my apt module from version 8.3.0 to version 8.2.0, the issue is gone.
I've tried to reproduce in a clean container, but I don't get the error you're seeing:
% docker run -ti --rm --entrypoint /bin/bash puppet/puppet-agent-ubuntu
root@25e533fa99e0:/# apt-get -qq update
root@25e533fa99e0:/# apt-get -qq install gpg
<...snip...>
root@25e533fa99e0:/# puppet module install puppetlabs-apt
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└─┬ puppetlabs-apt (v8.3.0)
└── puppetlabs-stdlib (v8.1.0)
root@25e533fa99e0:/# cat > test.pp << EOF
> notify { 'testing': }
>
> apt::source { 'docker':
> location => 'https://download.docker.com/linux/debian',
> repos => 'stable',
> key => {
> id => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
> source => 'https://download.docker.com/linux/debian/gpg',
> },
> }
> EOF
root@25e533fa99e0:/# puppet apply --test test.pp
Info: Loading facts
Info: Loading facts
Notice: Compiled catalog for 25e533fa99e0 in environment production in 0.29 seconds
Info: Using environment 'production'
Info: Applying configuration version '1641425150'
Notice: testing
Notice: /Stage[main]/Main/Notify[testing]/message: defined 'message' as 'testing'
Notice: /Stage[main]/Apt/File[preferences]/ensure: created
Info: /Stage[main]/Apt/File[preferences]: Scheduling refresh of Class[Apt::Update]
Notice: /Stage[main]/Apt/Apt::Setting[conf-update-stamp]/File[/etc/apt/apt.conf.d/15update-stamp]/ensure: defined content as '{sha256}2e6eb1f5f20262bfc6b7dfb26a302f00b4ab5fee803abd9e07ad8378cce067d5'
Info: /Stage[main]/Apt/Apt::Setting[conf-update-stamp]/File[/etc/apt/apt.conf.d/15update-stamp]: Scheduling refresh of Class[Apt::Update]
Notice: /Stage[main]/Main/Apt::Source[docker]/Apt::Key[Add key: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 from Apt::Source docker]/Apt_key[Add key: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 from Apt::Source docker]/ensure: created
Notice: /Stage[main]/Main/Apt::Source[docker]/Apt::Setting[list-docker]/File[/etc/apt/sources.list.d/docker.list]/ensure: defined content as '{sha256}3b763fab36a791b0d8063919462aa38dc61fe3dd4be8acb4900bbe8f31ce0118'
Info: /Stage[main]/Main/Apt::Source[docker]/Apt::Setting[list-docker]/File[/etc/apt/sources.list.d/docker.list]: Scheduling refresh of Class[Apt::Update]
Info: Class[Apt::Update]: Scheduling refresh of Exec[apt_update]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Ign:5 https://download.docker.com/linux/debian bionic InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Err:6 https://download.docker.com/linux/debian bionic Release
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: 404 Not Found [IP: 216.137.44.72 443]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Hit:7 http://apt.puppetlabs.com bionic InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Reading package lists...
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: E: The repository 'https://download.docker.com/linux/debian bionic Release' does not have a Release file.
Error: /Stage[main]/Apt::Update/Exec[apt_update]: Failed to call refresh: '/usr/bin/apt-get update' returned 100 instead of one of [0]
Error: /Stage[main]/Apt::Update/Exec[apt_update]: '/usr/bin/apt-get update' returned 100 instead of one of [0]
Info: Stage[main]: Unscheduling all events on Stage[main]
Notice: Applied catalog in 5.43 seconds
root@25e533fa99e0:/# exit
exit
%
The catalog compiles and applies fine, the error is only because the repo isn't quite right but that's not relevant to the problem you're seeing. What distribution/version are you using?
I had this with Debian Buster and Puppet 7.13.1.
Oddly enough, now that I unpinned the version and redownloaded the module, I cant reproduce it either. Thanks for checking it out.
No problem, glad it's working now.
Add support for optional apt::proxy::perhost array to configure bypass (DIRECT) or alternative proxy for specific repository hosts.