diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 15:57:40 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 15:57:40 +0000 |
| commit | 9f92a3d7b883082587461dbcb882d28ea7668df8 (patch) | |
| tree | 4f2e5fe4b66d5725ee5bfadef6503028d263c297 | |
| parent | 4d750418d00bdd39118493003d60481a35212ed1 (diff) | |
| download | puppet-9f92a3d7b883082587461dbcb882d28ea7668df8.tar.gz puppet-9f92a3d7b883082587461dbcb882d28ea7668df8.tar.xz puppet-9f92a3d7b883082587461dbcb882d28ea7668df8.zip | |
Adding the puppet client version to the fact list as "clientversion"
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1100 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | lib/puppet/client/master.rb | 6 | ||||
| -rw-r--r-- | test/client/master.rb | 18 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb index 6c30a4431..1da921aa4 100644 --- a/lib/puppet/client/master.rb +++ b/lib/puppet/client/master.rb @@ -9,6 +9,8 @@ class Puppet::Client::MasterClient < Puppet::Client new configurations, where you want to fix the broken configuration rather than reverting to a known-good one." ] + + ) @drivername = :Master @@ -19,6 +21,10 @@ class Puppet::Client::MasterClient < Puppet::Client facts[name] = fact.downcase } + # Add our client version to the list of facts, so people can use it + # in their manifests + facts["clientversion"] = Puppet.version.to_s + facts end diff --git a/test/client/master.rb b/test/client/master.rb index 11d49ac85..ddca0ba13 100644 --- a/test/client/master.rb +++ b/test/client/master.rb @@ -15,8 +15,10 @@ require 'puppettest.rb' class TestMasterClient < Test::Unit::TestCase include ServerTest - def mkmaster(file) + def mkmaster(file = nil) master = nil + + file ||= mktestmanifest() # create our master assert_nothing_raised() { # this is the default server setup @@ -29,7 +31,8 @@ class TestMasterClient < Test::Unit::TestCase return master end - def mkclient(master) + def mkclient(master = nil) + master ||= mkmaster() client = nil assert_nothing_raised() { client = Puppet::Client::MasterClient.new( @@ -69,4 +72,15 @@ class TestMasterClient < Test::Unit::TestCase assert(FileTest.exists?(@createdfile), "Enabled client did not run") end + + # Make sure we're getting the client version in our list of facts + def test_clientversionfact + facts = nil + assert_nothing_raised { + facts = Puppet::Client::MasterClient.facts + } + + assert_equal(Puppet.version.to_s, facts["clientversion"]) + + end end |
