summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2010-07-01 12:01:46 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-01 13:48:03 -0700
commit174e02a2b71fd51ff27f9186526352d79253da26 (patch)
treebd7d78e2eb18dd3394344c4f0b3112b0d52a49ba /lib/puppet/util
parent62e3b611e65deab60c615eac553cac9aa7e76d9d (diff)
downloadpuppet-174e02a2b71fd51ff27f9186526352d79253da26.tar.gz
puppet-174e02a2b71fd51ff27f9186526352d79253da26.tar.xz
puppet-174e02a2b71fd51ff27f9186526352d79253da26.zip
[#4090] Change how RunMode instances are created so that an object for each RunMode is only created once instead of every time it's called
Got lots of unpredictable test failures, presumably because a new RunMode was being created every time we accessed the RunMode.
Diffstat (limited to 'lib/puppet/util')
-rw-r--r--lib/puppet/util/run_mode.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/puppet/util/run_mode.rb b/lib/puppet/util/run_mode.rb
index 08f2c851f..029c1f921 100644
--- a/lib/puppet/util/run_mode.rb
+++ b/lib/puppet/util/run_mode.rb
@@ -5,8 +5,14 @@ module Puppet
@name = name.to_sym
end
+ @@run_modes = Hash.new {|h, k| h[k] = RunMode.new(k)}
+
attr :name
+ def self.[](name)
+ @@run_modes[name]
+ end
+
def master?
name == :master
end