summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-08-22 22:13:23 -0500
committerLuke Kanies <luke@madstop.com>2007-08-22 22:13:23 -0500
commit7c4d39ec09c10871d7eb234fe4392381245ff443 (patch)
tree32476596280f2b04107e00bcf256b8d7d4826794
parentb599862fc85c968676799edde865a96faa66a75b (diff)
downloadpuppet-7c4d39ec09c10871d7eb234fe4392381245ff443.tar.gz
puppet-7c4d39ec09c10871d7eb234fe4392381245ff443.tar.xz
puppet-7c4d39ec09c10871d7eb234fe4392381245ff443.zip
Adding environment information to the client fact list. The environment is retrieved from the normal Puppet configuration, so it is set via puppet.conf or the cli, rather than being a normal fact.
-rw-r--r--lib/puppet/network/client/master.rb3
-rwxr-xr-xtest/network/client/master.rb10
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb
index 41fd0f7f2..0286ab87b 100644
--- a/lib/puppet/network/client/master.rb
+++ b/lib/puppet/network/client/master.rb
@@ -38,6 +38,9 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
# in their manifests
facts["clientversion"] = Puppet.version.to_s
+ # And add our environment as a fact.
+ facts["environment"] = Puppet[:environment]
+
facts
end
diff --git a/test/network/client/master.rb b/test/network/client/master.rb
index 7746d20ff..7896d4019 100755
--- a/test/network/client/master.rb
+++ b/test/network/client/master.rb
@@ -683,6 +683,16 @@ end
end
end
+ def test_environment_is_added_to_facts
+ facts = Puppet::Network::Client::Master.facts
+ assert_equal(facts["environment"], Puppet[:environment], "Did not add environment to client facts")
+
+ # Now set it to a real value
+ Puppet[:environment] = "something"
+ facts = Puppet::Network::Client::Master.facts
+ assert_equal(facts["environment"], Puppet[:environment], "Did not add environment to client facts")
+ end
+
# This is partially to fix #532, but also to save on memory.
def test_remove_objects_after_every_run
client = mkclient