summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/parser_support.rb
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-09-03 11:17:35 -0700
committerMarkus Roberts <Markus@reality.com>2010-09-22 21:11:22 -0700
commitf95006148c3a0b4d7e8ee1812b1993b674f050e4 (patch)
tree5059295466481f3a1380d29642808bdfae006397 /lib/puppet/parser/parser_support.rb
parent8ff4b9a0b16310729a0411ad151ad0d0636069d5 (diff)
downloadpuppet-f95006148c3a0b4d7e8ee1812b1993b674f050e4.tar.gz
puppet-f95006148c3a0b4d7e8ee1812b1993b674f050e4.tar.xz
puppet-f95006148c3a0b4d7e8ee1812b1993b674f050e4.zip
[#4716] ResourceTypeAPI exposes implementation details that are likely to change
Made the following modifications to ResourceTypeAPI: (1) returned nil from “define”, “hostclass”, and “node”. (2) renamed “mk_resource_type” and “munge_type_arguments” to “__mk_resource_type__” and “__munge_type_arguments__” to discourage customers from calling them. (3) Made ResourceTypeAPI a class rather than a module, and changed the parser to evaluate the contents of pure ruby manifests using a instances of this class. (4) Changed ResourceTypeAPI to insert newly instantiated types into Thread.current[:known_resource_types] rather than the default environment's known_resource_types. This effectively backports the fix for issue #4657 to 2.6.x. Also backported the new spec tests from #4657.
Diffstat (limited to 'lib/puppet/parser/parser_support.rb')
-rw-r--r--lib/puppet/parser/parser_support.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 4f3a4ddff..c90c1978f 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -215,7 +215,9 @@ class Puppet::Parser::Parser
end
def parse_ruby_file
- require self.file
+ # Execute the contents of the file inside its own "main" object so
+ # that it can call methods in the resource type API.
+ Puppet::DSL::ResourceTypeAPI.new.instance_eval(File.read(self.file))
end
def string=(string)