diff options
author | Markus Roberts <Markus@reality.com> | 2010-07-11 12:12:43 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-11 12:12:43 -0700 |
commit | 1c3e844c120c3c91c63b64c093f94d5dbab7b946 (patch) | |
tree | bda2c8d6246c7ff6e8d227e9c7c0e2979f63a72f | |
parent | 99d8323ece06ffde0ddfb5753ef94541d473a9d9 (diff) | |
download | puppet-1c3e844c120c3c91c63b64c093f94d5dbab7b946.tar.gz puppet-1c3e844c120c3c91c63b64c093f94d5dbab7b946.tar.xz puppet-1c3e844c120c3c91c63b64c093f94d5dbab7b946.zip |
Minimal fix for #4205 -- incorrect Import loop messages
This patch fixes the narrow problem of #4205, wherein type_loader would reparse
a file each time it was imported (causing the parser to incorrectly think that
it was in a loop) by checking @imported inside the existing check on the
thread-guarded @loaded. (@imported was being set but never checked).
This works (and is thread safe) because all of this is going on inside a giant
synchronize care of @loaded. But it, like the fix for #4208, does nothing
about the global lock.
Areas for future research:
1) Why is the looping inside of import?
2) Why are there separate @loaded and @imported tables?
3) Why is the parsing treated like a function (called deep in the structure)
yet coded like a thread-savvy pseudo state monad (e.g. raising errors that
presume it knows/owns what's going on outside the whole process)?
These and many other exciting questions are deferred to #4211
-rw-r--r-- | lib/puppet/parser/type_loader.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/puppet/parser/type_loader.rb b/lib/puppet/parser/type_loader.rb index 6c32f6a92..cb8657f0c 100644 --- a/lib/puppet/parser/type_loader.rb +++ b/lib/puppet/parser/type_loader.rb @@ -51,8 +51,10 @@ class Puppet::Parser::TypeLoader unless file =~ /^#{File::SEPARATOR}/ file = File.join(dir, file) end - @imported[file] = true - parse_file(file) + unless imported? file + @imported[file] = true + parse_file(file) + end end modname |