summaryrefslogtreecommitdiff
path: root/lib/puppet.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet.rb')
-rw-r--r--lib/puppet.rb58
1 files changed, 34 insertions, 24 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb
index bf54dd764..2a52e9887 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -40,6 +40,27 @@ module Puppet
# the hash that determines how our system behaves
@@settings = Puppet::Settings.new
+ # Note: It's important that these accessors (`self.settings`, `self.[]`) are
+ # defined before we try to load any "features" (which happens a few lines below),
+ # because the implementation of the features loading may examine the values of
+ # settings.
+ def self.settings
+ @@settings
+ end
+
+ # Get the value for a setting
+ #
+ # @param [Symbol] param the setting to retrieve
+ #
+ # @api public
+ def self.[](param)
+ if param == :debug
+ return Puppet::Util::Log.level == :debug
+ else
+ return @@settings[param]
+ end
+ end
+
# The services running in this process.
@services ||= []
@@ -58,19 +79,6 @@ module Puppet
@@settings.define_settings(section, hash)
end
- # Get the value for a setting
- #
- # @param [Symbol] param the setting to retrieve
- #
- # @api public
- def self.[](param)
- if param == :debug
- return Puppet::Util::Log.level == :debug
- else
- return @@settings[param]
- end
- end
-
# setting access and stuff
def self.[]=(param,value)
@@settings[param] = value
@@ -88,11 +96,6 @@ module Puppet
end
end
- def self.settings
- @@settings
- end
-
-
def self.run_mode
# This sucks (the existence of this method); there are a lot of places in our code that branch based the value of
# "run mode", but there used to be some really confusing code paths that made it almost impossible to determine
@@ -184,14 +187,21 @@ module Puppet
loaders = Puppet::Environments::Directories.from_path(environments, modulepath)
# in case the configured environment (used for the default sometimes)
# doesn't exist
- loaders << Puppet::Environments::StaticPrivate.new(
- Puppet::Node::Environment.create(Puppet[:environment].to_sym,
- [],
- Puppet::Node::Environment::NO_MANIFEST))
+ default_environment = Puppet[:environment].to_sym
+ if default_environment == :production
+ loaders << Puppet::Environments::StaticPrivate.new(
+ Puppet::Node::Environment.create(Puppet[:environment].to_sym,
+ [],
+ Puppet::Node::Environment::NO_MANIFEST))
+ end
end
{
- :environments => Puppet::Environments::Cached.new(*loaders)
+ :environments => Puppet::Environments::Cached.new(*loaders),
+ :http_pool => proc {
+ require 'puppet/network/http'
+ Puppet::Network::HTTP::NoCachePool.new
+ }
}
end
@@ -199,7 +209,7 @@ module Puppet
# initialization where the {base_context} bindings are put in place
# @api private
def self.bootstrap_context
- root_environment = Puppet::Node::Environment.create(:'*root*', [], '')
+ root_environment = Puppet::Node::Environment.create(:'*root*', [], Puppet::Node::Environment::NO_MANIFEST)
{
:current_environment => root_environment,
:root_environment => root_environment