You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module include the class apt but if it is called elsewhere with parameters this will conflict.
If included elsewhere on a node it will lead to :
Error while evaluating a Resource Statement, Duplicate declaration: Class[Apt] is already declared;
Expected Behavior
It should not think important class like the APT one is used only in the module as it can be used elsewhere with parameters and other things. a quick test can help i think ?
+ if !defined(Class['apt']) {
+ include apt
+ }
this seems enough to prevent this :)
Steps to Reproduce
Steps to reproduce the behavior:
use in a node the apt class, then use the puppet agent module.
Environment
Version [e.g. 1.27.0]├── puppetlabs-puppet_agent (v4.20.1)
Platform [e.g. Ubuntu 18.04] debian 11
Additional Context
here is the patch i used:
diff --git a/modules/puppet_agent/manifests/osfamily/debian.pp b/modules/puppet_agent/manifests/osfamily/debian.pp
index 7cbd9d3e..e434f8fd 100644
--- a/modules/puppet_agent/manifests/osfamily/debian.pp
+++ b/modules/puppet_agent/manifests/osfamily/debian.pp
@@ -13,7 +13,9 @@ class puppet_agent::osfamily::debian {
contain puppet_agent::prepare::package
} else {
if getvar('::puppet_agent::manage_repo') == true {
- include apt
+ if !defined(Class['apt']) {
+ include apt
+ }
if ($puppet_agent::is_pe and (!$puppet_agent::use_alternate_sources)) {
$pe_server_version = pe_build_version()
if $puppet_agent::source {
The text was updated successfully, but these errors were encountered:
Describe the Bug
hi,
This module include the class apt but if it is called elsewhere with parameters this will conflict.
If included elsewhere on a node it will lead to :
Error while evaluating a Resource Statement, Duplicate declaration: Class[Apt] is already declared;
Expected Behavior
It should not think important class like the APT one is used only in the module as it can be used elsewhere with parameters and other things. a quick test can help i think ?
this seems enough to prevent this :)
Steps to Reproduce
Steps to reproduce the behavior:
use in a node the apt class, then use the puppet agent module.
Environment
Additional Context
here is the patch i used:
The text was updated successfully, but these errors were encountered: