puppet-unattended_upgrades
puppet-unattended_upgrades copied to clipboard
Error while evaluating a Resource Statement, Duplicate declaration: Package[unattended-upgrades] is already declared
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 7.23.0
- Ruby: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
- Distribution: Debian GNU/Linux 12 (bookworm)
- Module version: 8.0.0
How to reproduce (e.g Puppet code you use)
# Basic config for all Debian nodes
class profile::debianapt {
# install basic packages
class { 'apt':
update => {
frequency => 'daily',
},
purge => {
'sources.list' => true
},
}
apt::source { "deb.debian.org-${facts['os']['distro']['codename']}":
location => 'http://deb.debian.org/debian/',
repos => 'main non-free-firmware non-free contrib',
include => {src => true}
}
# noch mehr apt sources
class { 'unattended_upgrades':
auto => {
clean => 'always',
remove => true
},
enable => true,
origins => [
'origin=${distro_id},suite=${distro_codename}',
'origin=${distro_id},suite=${distro_codename}-security',
'origin=${distro_id},suite=${distro_codename}-backports',
'origin=${distro_id},suite=${distro_codename}-updates',
],
remove_new_unused_deps => true,
}
}
What are you seeing
error about duplicate declaration when trying to run puppet agent --test
What behaviour did you expect instead
successfully configuring unattended upgrades
Output log
root:/etc/puppet/code/environments/production# puppet agent --test
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[unattended-upgrades] is already declared at (file: /etc/puppet/code/environments/production/modules/profile/manifests/debianapt.pp, line: 16); cannot redeclare (file: /etc/puppet/code/environments/production/modules/unattended_upgrades/manifests/init.pp, line: 50) (file: /etc/puppet/code/environments/production/modules/unattended_upgrades/manifests/init.pp, line: 50, column: 3) on node puppet.jmbfountain.de
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Any additional information you'd like to impart
I'm fairly new to both Puppet and Ruby, so this might just be an error I made and don't know how to correctly google.
I installed the module using puppet module install puppet-unattended_upgrades --version 8.0.0
and declared it using
class { 'unattended_upgrades':
age => { 'max' => 10 },
}
as shown in the README.
However, if I then try to roll this out to an agent, it says it can't declare unattended_upgrades in the init.pp of the unattended_Upgrades module because it's already declared.