Fixed #1184 -- definitions now autoload correctly all of the time.

This commit is contained in:
Luke Kanies 2008-04-10 23:18:20 -05:00
Родитель 376628d117
Коммит 2925ad1cb9
3 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,5 @@
Fixed #1184 -- definitions now autoload correctly all of the time.
Removed the code from the client that tries to avoid recompiling
the catalog. The client will now always recompile, assuming it
can reach the server. It will still use the cached config if

Просмотреть файл

@ -237,7 +237,9 @@ class Puppet::Parser::Parser
end
end
return true if classes.include?(classname)
# We don't know whether we're looking for a class or definition, so we have
# to test for both.
return true if classes.include?(classname) || definitions.include?(classname)
unless @loaded.include?(filename)
@loaded << filename
@ -249,7 +251,9 @@ class Puppet::Parser::Parser
# We couldn't load the file
end
end
return classes.include?(classname)
# We don't know whether we're looking for a class or definition, so we have
# to test for both.
return classes.include?(classname) || definitions.include?(classname)
end
# Split an fq name into a namespace and name

Просмотреть файл

@ -1141,7 +1141,6 @@ file { "/tmp/yayness":
name = "sub"
mk_module(modname, :init => %w{separate}, :sub => %w{separate::sub})
Puppet.err :yay
# First try it with a namespace
klass = parser.findclass("separate", name)
assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from separate file with a namespace")
@ -1171,6 +1170,14 @@ file { "/tmp/yayness":
klass = parser.findclass("", "alone::sub")
assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from alone file with no namespace")
assert_equal("alone::sub", klass.classname, "Incorrect class was returned")
# and with the definition in its own file
name = "mymod"
mk_module(name, :define => true, :mydefine => ["mymod::mydefine"])
klass = parser.finddefine("", "mymod::mydefine")
assert_instance_of(AST::Definition, klass, "Did not autoload definition from its own file")
assert_equal("mymod::mydefine", klass.classname, "Incorrect definition was returned")
end
# Make sure class, node, and define methods are case-insensitive