Issue #4205 has been updated by Markus Roberts.

It appears this was previously handled by the layer which is now know as the 
type_loader (the second import didn't result in an attempt to reload) but now 
it's passing through to the parser, which is squawking "hey, I've already done 
this one."

The parser (which is what most people would call a compiler) shouldn't be 
checking this (it should be shaped more like a function, which takes source and 
returns an AST, as opposed to a thread-savvy monad with benefits, which takes 
source and updates universal state) but that's a whole other issue.

The point is that this may be the flip side of #4208 / #4211; it's observable 
just running puppet apply, with no client/server/threading/phase-of-moon issues 
to confound things.



----------------------------------------
Bug #4205: Importing manually twice a module produce an import loop error
http://projects.puppetlabs.com/issues/4205

Author: Brice Figureau
Status: Investigating
Priority: Low
Assigned to: Markus Roberts
Category: compiler
Target version: 2.6.0
Affected version: 2.6.0rc1
Keywords: 
Branch: 


Let's say we have the following manifest (inherited from a legacy 0.23.x 
production site :-)):
<pre>
import "test"
import "test"
</pre>

2.6-rc1 produce the following error:
<pre>
debug: importing 
'/Users/brice/devl/puppet/manifests/modules/test/manifests/init.pp' in 
environment production
debug: importing 
'/Users/brice/devl/puppet/manifests/modules/test/manifests/init.pp' in 
environment production
/Users/brice/devl/puppet/lib/puppet/parser/parser_support.rb:93:in `file='
/Users/brice/devl/puppet/lib/puppet/parser/type_loader.rb:121:in `parse_file'
/Users/brice/devl/puppet/lib/puppet/parser/type_loader.rb:55:in `import'
/Users/brice/devl/puppet/lib/puppet/parser/type_loader.rb:50:in `each'
/Users/brice/devl/puppet/lib/puppet/parser/type_loader.rb:50:in `import'
/Users/brice/devl/puppet/lib/puppet/parser/parser_support.rb:114:in `import'
grammar.ra:674:in `_reduce_178'
grammar.ra:673:in `each'
grammar.ra:673:in `_reduce_178'
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in 
`_racc_yyparse_c'
/Users/brice/devl/puppet/lib/puppet/util/autoload.rb:79:in `catch'
/Users/brice/devl/puppet/lib/puppet/util/autoload.rb:79:in `_racc_yyparse_c'
/Users/brice/devl/puppet/lib/puppet/parser/lexer.rb:504:in `scan'
/opt/local/lib/ruby/1.8/racc/parser.rb:152:in `_racc_yyparse_c'
/opt/local/lib/ruby/1.8/racc/parser.rb:152:in `__send__'
/opt/local/lib/ruby/1.8/racc/parser.rb:152:in `yyparse'
/Users/brice/devl/puppet/lib/puppet/parser/parser_support.rb:181:in `parse'
/Users/brice/devl/puppet/lib/puppet/resource/type_collection.rb:164:in 
`perform_initial_import'
/Users/brice/devl/puppet/lib/puppet/node/environment.rb:75:in 
`known_resource_types'
/Users/brice/devl/puppet/lib/puppet/resource/type_collection_helper.rb:5:in 
`known_resource_types'
/Users/brice/devl/puppet/lib/puppet/parser/compiler.rb:437:in `initvars'
/Users/brice/devl/puppet/lib/puppet/parser/compiler.rb:180:in `initialize'
/Users/brice/devl/puppet/lib/puppet/parser/compiler.rb:18:in `new'
/Users/brice/devl/puppet/lib/puppet/parser/compiler.rb:18:in `compile'
/Users/brice/devl/puppet/lib/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
/Users/brice/devl/puppet/lib/puppet/util.rb:180:in `benchmark'
/Users/brice/devl/puppet/lib/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
/Users/brice/devl/puppet/lib/puppet/indirector/catalog/compiler.rb:34:in `find'
/Users/brice/devl/puppet/lib/puppet/indirector/indirection.rb:193:in `find'
/Users/brice/devl/puppet/lib/puppet/indirector.rb:50:in `find'
/Users/brice/devl/puppet/lib/puppet/application/apply.rb:112:in `main'
/Users/brice/devl/puppet/lib/puppet/application/apply.rb:35:in `run_command'
/Users/brice/devl/puppet/lib/puppet/application.rb:301:in `run'
/Users/brice/devl/puppet/lib/puppet/application.rb:398:in `exit_on_fail'
/Users/brice/devl/puppet/lib/puppet/application.rb:301:in `run'
/Users/brice/devl/puppet/lib/puppet/util/command_line.rb:55:in `execute'
./bin/puppet:4
/Users/brice/devl/puppet/lib/puppet/parser/compiler.rb:21:in `compile'
/Users/brice/devl/puppet/lib/puppet/indirector/catalog/compiler.rb:77:in 
`compile'
/Users/brice/devl/puppet/lib/puppet/util.rb:180:in `benchmark'
/Users/brice/devl/puppet/lib/puppet/indirector/catalog/compiler.rb:75:in 
`compile'
/Users/brice/devl/puppet/lib/puppet/indirector/catalog/compiler.rb:34:in `find'
/Users/brice/devl/puppet/lib/puppet/indirector/indirection.rb:193:in `find'
/Users/brice/devl/puppet/lib/puppet/indirector.rb:50:in `find'
/Users/brice/devl/puppet/lib/puppet/application/apply.rb:112:in `main'
/Users/brice/devl/puppet/lib/puppet/application/apply.rb:35:in `run_command'
/Users/brice/devl/puppet/lib/puppet/application.rb:301:in `run'
/Users/brice/devl/puppet/lib/puppet/application.rb:398:in `exit_on_fail'
/Users/brice/devl/puppet/lib/puppet/application.rb:301:in `run'
/Users/brice/devl/puppet/lib/puppet/util/command_line.rb:55:in `execute'
./bin/puppet:4
Could not parse for environment production: Import loop detected at 
/Users/brice/devl/puppet/manifests/module.pp:5 on node macbook.local
</pre>

It is not an import loop as the error message says, it's just that we're 
importing the module twice.
0.25.x was more liberal as it supported this "error" without erroring message.



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to