Puppet: System Administration Automated

Support

Ticket #971 (closed defect: fixed)

Opened 1 year ago

Last modified 11 months ago

Cannot include a class twice in 0.24

Reported by: whaymand Assigned to: luke
Priority: normal Milestone: elmo
Component: library Version: 0.24.1
Severity: critical Keywords: include class
Cc: Triage Stage: Accepted
Attached Patches: None Complexity: Easy

Description

I'm pretty sure this bug didn't exist when I tested against GIT, but it seems if you include a class twice, Puppet barfs (both 0.24.0 and 0.24.1). I suspect it was broken before 0.24.0 was cut but after I tested.

<0> sa_dewha@engpsr0142.intranetdev.barcapdev.com (0 jobs)
 /users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples
  % sudo ./test.sh
Password:
++ pwd
+ MODULEDIR=/users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples/../..
+ puppet --color=false -v --no-report --server=localhost --modulepath=/users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples/../.. --libdir=/var/lib/puppet/plugins ./setup.pp
info: Autoloaded module ytest
notice: Scope(Class[ytest::setup]): YTEST
info: Autoloaded module xtest
notice: Scope(Class[xtest::setup]): XTEST
Resource Class[xtest::setup] is already defined
<1> sa_dewha@engpsr0142.intranetdev.barcapdev.com (0 jobs)
 /users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples

On 0.23.2 it works:

<0> sa_dewha@engpsr0000.intranetdev.barcapdev.com (0 jobs)
 /users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples
  % sudo ./test.sh           
++ pwd
+ MODULEDIR=/users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples/../..
+ puppet --color=false -v --no-report --server=localhost --modulepath=/users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples/../.. --libdir=/var/lib/puppet/plugins ./setup.pp
info: Loading fact lomfacts
info: Loading fact hwfacts
info: Loading fact swap
info: Loading fact roothome
info: Loading fact virtual
info: Loading fact installed_kernels
info: Loading fact blastwave
info: Loading fact build_details
info: Loading fact satellite
info: Autoloaded module ytest
notice: ytest::setup: YTEST
info: Autoloaded module xtest
notice: xtest::setup: XTEST
<0> sa_dewha@engpsr0000.intranetdev.barcapdev.com (0 jobs)
 /users/unix/sa_dewha/SVNCheckOut/bootstrap/puppet/modules/ytest/examples

Alas we use this facility extensively to instantiate resources that are required by multiple modules. If File X is a dependency of module Y and module Z, typically we'll include modulex::subsection in both module Y and Z. This preserves our ability to run each module alone (and pull in the subsection) and also for the entire configuration to compile with unique resources.

Therefore our configuration doesn't work against either 0.24.0 or 0.24.1.

I will upload the two modules as an attachment.

I found this when trying out your configuration compiling idea from IRC.

Regards, Derek

Attachments

dblinclude.tgz (0.7 kB) - added by whaymand on 12/27/07 12:04:18.

Change History

12/27/07 12:04:18 changed by whaymand

  • attachment dblinclude.tgz added.

12/28/07 03:45:05 changed by jamtur01

  • status changed from new to assigned.
  • owner changed from community to jamtur01.
  • complexity changed from Unknown to Easy.
  • version set to 0.24.1.
  • milestone set to kermit.
  • keywords set to include class.
  • stage changed from Unreviewed to Accepted.

I can replicate this on 0.24.1:

puppet --trace ./test.pp Could not autoload "/usr/local/lib/site_ruby/1.8/puppet/parser/ast/resourceoverride.rb": superclass mismatch for class Resource Override? notice: Scope(Class[xtest::setup]): XTEST /usr/local/lib/site_ruby/1.8/puppet/node/catalog.rb:64:in `add_resource' /usr/local/lib/site_ruby/1.8/puppet/node/catalog.rb:57:in `each' /usr/local/lib/site_ruby/1.8/puppet/node/catalog.rb:57:in `add_resource' /usr/local/lib/site_ruby/1.8/puppet/node/catalog.rb:474:in `to_catalog' /usr/local/lib/site_ruby/1.8/puppet/node/catalog.rb:464:in `each' /usr/local/lib/site_ruby/1.8/puppet/node/catalog.rb:464:in `to_catalog' /usr/local/lib/site_ruby/1.8/puppet/node/catalog.rb:417:in `to_transportable' /usr/local/lib/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:24:in `find' /usr/local/lib/site_ruby/1.8/puppet/indirector/indirection.rb:170:in `find' /usr/local/lib/site_ruby/1.8/puppet/indirector.rb:42:in `find' /usr/bin/puppet:199 Resource Class[xtest::setup] is already defined

test.pp:

include xtest::setup include xtest::setup

12/28/07 04:33:07 changed by jamtur01

  • milestone changed from kermit to elmo.

01/01/08 04:39:56 changed by jamtur01

  • owner changed from jamtur01 to luke.
  • status changed from assigned to new.

01/07/08 18:06:49 changed by luke

  • status changed from new to assigned.
  • severity changed from normal to critical.

01/07/08 19:19:36 changed by luke

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed in [927dff4].