summaryrefslogtreecommitdiffstats
path: root/test/language/parser.rb
diff options
context:
space:
mode:
authorlutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-09 00:52:47 +0000
committerlutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-09 00:52:47 +0000
commit0fa3c434b658fe432c306dc9e52e6b8c949ad3cf (patch)
tree21f012dd7ef63123f00cf5d207313177ed17d1aa /test/language/parser.rb
parent38975de420bfd2f1350e7e55a996db40bc05d0b8 (diff)
downloadpuppet-0fa3c434b658fe432c306dc9e52e6b8c949ad3cf.tar.gz
puppet-0fa3c434b658fe432c306dc9e52e6b8c949ad3cf.tar.xz
puppet-0fa3c434b658fe432c306dc9e52e6b8c949ad3cf.zip
Search manifests first within modules, and if no module is found, search in
the directory the current manifest is in. Glob patterns can be used for the path, but the path only matches a module if the first part of the path is not a glob. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2279 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/language/parser.rb')
-rwxr-xr-xtest/language/parser.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/language/parser.rb b/test/language/parser.rb
index d58c5e1bf..1bfcb49cc 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -658,6 +658,50 @@ file { "/tmp/yayness":
parser.parse %{$testing = template()}
}
end
+
+ def test_module_import
+ basedir = File.join(tmpdir(), "module-import")
+ @@tmpfiles << basedir
+ Dir.mkdir(basedir)
+ modfiles = [ "init.pp", "mani1.pp", "mani2.pp",
+ "sub/smani1.pp", "sub/smani2.pp" ]
+
+ modpath = File.join(basedir, "modules")
+ Puppet[:modulepath] = modpath
+
+ modname = "amod"
+ manipath = File::join(modpath, modname, Puppet::Module::MANIFESTS)
+ FileUtils::mkdir_p(File::join(manipath, "sub"))
+ targets = []
+ modfiles.each do |fname|
+ target = File::join(basedir, File::basename(fname, '.pp'))
+ targets << target
+ txt = %[ file { '#{target}': content => "#{fname}" } ]
+ if fname == "init.pp"
+ txt = %[import 'mani1' \nimport '#{modname}/mani2'\nimport '#{modname}/sub/*.pp' ] + txt
+ end
+ File::open(File::join(manipath, fname), "w") do |f|
+ f.puts txt
+ end
+ end
+
+ manifest_texts = [ "import '#{modname}'",
+ "import '#{modname}/init'",
+ "import '#{modname}/init.pp'" ]
+
+ manifest = File.join(modpath, "manifest.pp")
+ manifest_texts.each do |txt|
+ File.open(manifest, "w") { |f| f.puts txt }
+
+ assert_nothing_raised {
+ parser = mkparser
+ parser.file = manifest
+ parser.parse
+ }
+ assert_creates(manifest, *targets)
+ end
+ end
+
end
# $Id$