diff options
author | Luke Kanies <luke@puppetlabs.com> | 2010-07-19 17:12:13 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-19 19:56:10 -0700 |
commit | 42a475ee6e865cc175b10a3edb3e5e738e72c738 (patch) | |
tree | 7429692d5936b021fcba05156c610d5ffbedd50d /lib/puppet | |
parent | 06fc40c5d755a41c8ece84a3d437572a64b4c899 (diff) | |
download | puppet-42a475ee6e865cc175b10a3edb3e5e738e72c738.tar.gz puppet-42a475ee6e865cc175b10a3edb3e5e738e72c738.tar.xz puppet-42a475ee6e865cc175b10a3edb3e5e738e72c738.zip |
Fixing #4268 - manifests always imported
The problem is that the environment list gets cleared
when Settings#set_value is called, and it was being
called every time Settings#use was called, which is
more often than obvious but especially if reporting
is enabled.
Previously we ignored noop when running inside of Settings,
and this essentially adds that back in, so we can remove
the special noop behaviour in Settings itself.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/type.rb | 4 | ||||
-rw-r--r-- | lib/puppet/util/settings.rb | 21 |
2 files changed, 10 insertions, 15 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 880711066..c3855a400 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -723,6 +723,10 @@ class Type # Are we running in noop mode? def noop? + # If we're not a host_config, we're almost certainly part of + # Settings, and we want to ignore 'noop' + return false if catalog and ! catalog.host_config? + if defined?(@noop) @noop else diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index cbb12a816..ca4ecda35 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -157,13 +157,6 @@ class Puppet::Util::Settings set_value(str, value, :cli) end - def without_noop - old_noop = value(:noop,:cli) and set_value(:noop, false, :cli) if valid?(:noop) - yield - ensure - set_value(:noop, old_noop, :cli) if valid?(:noop) - end - def include?(name) name = name.intern if name.is_a? String @config.include?(name) @@ -635,14 +628,12 @@ if @config.include?(:run_mode) return end - without_noop do - catalog.host_config = false - catalog.apply do |transaction| - if transaction.any_failed? - report = transaction.report - failures = report.logs.find_all { |log| log.level == :err } - raise "Got #{failures.length} failure(s) while initializing: #{failures.collect { |l| l.to_s }.join("; ")}" - end + catalog.host_config = false + catalog.apply do |transaction| + if transaction.any_failed? + report = transaction.report + failures = report.logs.find_all { |log| log.level == :err } + raise "Got #{failures.length} failure(s) while initializing: #{failures.collect { |l| l.to_s }.join("; ")}" end end |