Issue #2807 has been updated by James Turnbull.
Code here:
<pre>
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index 4357a3a..0a9d080 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -97,6 +97,7 @@ class Puppet::Parser::Compiler
def compile
# Set the client's parameters into the top scope.
set_node_parameters()
+ create_settings_scope
evaluate_main()
@@ -447,7 +448,7 @@ class Puppet::Parser::Compiler
@catalog.version = known_resource_types.version
# Create our initial scope and a resource that will evaluate main.
- @topscope = Puppet::Parser::Scope.new(:compiler => self, :source =>
'implicit')
+ @topscope = Puppet::Parser::Scope.new(:compiler => self)
@main_stage_resource = Puppet::Parser::Resource.new("stage", :main,
:scope => @topscope)
@catalog.add_resource(@main_stage_resource)
@@ -470,6 +471,25 @@ class Puppet::Parser::Compiler
catalog.server_version = node.parameters["serverversion"]
end
+ def create_settings_scope
+ unless settings_type =
environment.known_resource_types.hostclass("settings")
+ settings_type = Puppet::Resource::Type.new :hostclass, "settings"
+ environment.known_resource_types.add(settings_type)
+ end
+
+ settings_resource = Puppet::Parser::Resource.new("class", "settings",
:scope => @topscope)
+ settings_type.evaluate_code(settings_resource)
+
+ @catalog.add_resource(settings_resource)
+
+ scope = @topscope.class_scope(settings_type)
+
+ Puppet.settings.each do |name, setting|
+ next if name.to_s == "name"
+ scope.setvar name.to_s, environment[name]
+ end
+ end
+
# Return an array of all of the unevaluated resources. These will be
definitions,
# which need to get evaluated into native resources.
def unevaluated_resources
<pre>
----------------------------------------
Feature #2807: Settings should be available within the parser
http://projects.puppetlabs.com/issues/2807
Author: Mario Verbelen
Status: Accepted
Priority: Normal
Assigned to: Markus Roberts
Category: language
Target version: 2.6
Affected version: 0.25.1
Keywords:
Branch:
It should be straightforward to make all of the Puppet settings available as
variables within the language, and this has been asked for many times.
--
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.