summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-29 11:50:17 -0600
committerLuke Kanies <luke@madstop.com>2008-02-29 11:50:17 -0600
commit7ca0ad64f486c5dc50513e6d06c8e0725ce4f7f8 (patch)
tree4e74fcdc936b363d4bc2b001fb034242164d983f
parent43aea83eb1ac388566246e5418394e31a4cad697 (diff)
downloadpuppet-7ca0ad64f486c5dc50513e6d06c8e0725ce4f7f8.tar.gz
puppet-7ca0ad64f486c5dc50513e6d06c8e0725ce4f7f8.tar.xz
puppet-7ca0ad64f486c5dc50513e6d06c8e0725ce4f7f8.zip
Fixing a test that changed the environment for all later tests,
thus breaking some of them.
-rw-r--r--lib/puppet/network/client/master.rb11
-rwxr-xr-xtest/network/client/master.rb10
2 files changed, 7 insertions, 14 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb
index 390f3d4e2..913c51b3d 100644
--- a/lib/puppet/network/client/master.rb
+++ b/lib/puppet/network/client/master.rb
@@ -26,14 +26,15 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
down = Puppet[:downcasefacts]
- facts = {}
- Facter.each { |name,fact|
+ facts = Facter.to_hash.inject({}) do |newhash, array|
+ name, fact = array
if down
- facts[name] = fact.to_s.downcase
+ newhash[name] = fact.to_s.downcase
else
- facts[name] = fact.to_s
+ newhash[name] = fact.to_s
end
- }
+ newhash
+ end
# Add our client version to the list of facts, so people can use it
# in their manifests
diff --git a/test/network/client/master.rb b/test/network/client/master.rb
index 67c47fa6d..41796575f 100755
--- a/test/network/client/master.rb
+++ b/test/network/client/master.rb
@@ -216,15 +216,7 @@ end
name = "environment"
value = "test_environment"
- Puppet[:filetimeout] = -1
- Puppet[:factsource] = tempfile()
- Dir.mkdir(Puppet[:factsource])
- file = File.join(Puppet[:factsource], "#{name}.rb")
- File.open(file, "w") do |f|
- f.puts %{Facter.add("#{name}") do setcode { "#{value}" } end }
- end
-
- Puppet::Network::Client.master.getfacts
+ Facter.stubs(:to_hash).returns(name => value)
assert_equal(value, Puppet::Network::Client.master.facts[name])
end