From 5d35bc5904a09bc07a11039500c59021bafaee7e Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sat, 23 Feb 2008 08:41:24 +1100 Subject: Fixes #1078 and includes new test --- lib/puppet/network/client/master.rb | 6 ++++-- test/network/client/master.rb | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index 6d1a0235f..390f3d4e2 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -40,8 +40,10 @@ class Puppet::Network::Client::Master < Puppet::Network::Client facts["clientversion"] = Puppet.version.to_s # And add our environment as a fact. - facts["environment"] = Puppet[:environment] - + unless facts.include?("environment") + facts["environment"] = Puppet[:environment] + end + facts end diff --git a/test/network/client/master.rb b/test/network/client/master.rb index 696d08bfd..67c47fa6d 100755 --- a/test/network/client/master.rb +++ b/test/network/client/master.rb @@ -211,6 +211,24 @@ end "Lost value to hostname") end + # Make sure that setting environment by fact takes precedence to configuration + def test_setenvironmentwithfact + 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 + + assert_equal(value, Puppet::Network::Client.master.facts[name]) + end + # Make sure we load all facts on startup. def test_loadfacts dirs = [tempfile(), tempfile()] -- cgit From f184228956fc4c2050a5901130fd506b8f069dd6 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sun, 24 Feb 2008 09:32:44 +1100 Subject: Fixes ticket #1079 - added . support for tags --- lib/puppet/util/tagging.rb | 2 +- spec/unit/util/tagging.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb index 9abb3fb2b..8a50f3458 100644 --- a/lib/puppet/util/tagging.rb +++ b/lib/puppet/util/tagging.rb @@ -34,6 +34,6 @@ module Puppet::Util::Tagging private def valid_tag?(tag) - tag =~ /^\w[-\w:]*$/ + tag =~ /^\w[-\w:.]*$/ end end diff --git a/spec/unit/util/tagging.rb b/spec/unit/util/tagging.rb index 91cbb213d..d61ee8ccb 100755 --- a/spec/unit/util/tagging.rb +++ b/spec/unit/util/tagging.rb @@ -61,6 +61,10 @@ describe Puppet::Util::Tagging, "when adding tags" do lambda { @tagger.tag("good_tag") }.should_not raise_error(Puppet::ParseError) end + it "should allow tags containing '.' characters" do + lambda { @tagger.tag("good.tag") }.should_not raise_error(Puppet::ParseError) + end + it "should provide a method for testing tag validity" do @tagger.metaclass.publicize_methods(:valid_tag?) { @tagger.should be_respond_to(:valid_tag?) } end -- cgit From 939c952465815486da0d6c1a2207debb61a45618 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sun, 24 Feb 2008 09:47:12 +1100 Subject: Fixes ticket #1080 --- lib/puppet/sslcertificates.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/sslcertificates.rb b/lib/puppet/sslcertificates.rb index bd0ce8c92..0c579d0ad 100755 --- a/lib/puppet/sslcertificates.rb +++ b/lib/puppet/sslcertificates.rb @@ -72,7 +72,7 @@ module Puppet::SSLCertificates subject_alt_name << 'DNS:' + name.sub(/^[^.]+./, "puppet.") # add puppet.domain as an alias end key_usage = %w{digitalSignature keyEncipherment} - ext_key_usage = %w{serverAuth clientAuth} + ext_key_usage = %w{serverAuth clientAuth emailProtection} when :ocsp: basic_constraint = "CA:FALSE" key_usage = %w{nonRepudiation digitalSignature} -- cgit