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

puppet agent include the APT class locking it and will make other .pp fail if they include apt #731

Open
aqueos opened this issue Aug 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aqueos
Copy link

aqueos commented Aug 6, 2024

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 ?

+      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 {

@aqueos aqueos added the bug Something isn't working label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant