diff options
| -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 |
