diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/puppet/node.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 7 | ||||
-rwxr-xr-x | spec/unit/node.rb | 16 | ||||
-rwxr-xr-x[-rw-r--r--] | vendor/gems/rspec/bin/spec | 0 |
5 files changed, 26 insertions, 1 deletions
@@ -1,3 +1,5 @@ + The environment is now available as a variable in the manifests. + Fixed #1017 -- environment-specific modulepath is no longer ignored. Fixed #971 -- classes can once again be included multiple diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index c0628ecdc..252ab961e 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -161,5 +161,7 @@ class Puppet::Node params.each do |name, value| @parameters[name] = value unless @parameters.include?(name) end + + @parameters["environment"] ||= self.environment if self.environment end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c98709597..3aa3b0202 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,7 +6,12 @@ $LOAD_PATH.unshift("#{dir}/../test/lib") # Add the old test dir, so that we can # include any gems in vendor/gems Dir["#{dir}/../vendor/gems/**"].map do |path| - $LOAD_PATH.unshift(File.directory?(lib = "#{dir}/lib") ? lib : path) + libpath = File.join(path, "lib") + if File.directory?(libpath) + $LOAD_PATH.unshift(libpath) + else + $LOAD_PATH.unshift(path) + end end require 'puppettest' diff --git a/spec/unit/node.rb b/spec/unit/node.rb index 0ce702936..96e1d5617 100755 --- a/spec/unit/node.rb +++ b/spec/unit/node.rb @@ -113,6 +113,22 @@ describe Puppet::Node, " when merging facts" do @node.merge "two" => "three" @node.parameters["two"].should == "three" end + + it "should add the environment to the list of parameters" do + Puppet.settings.stubs(:value).with(:environments).returns("one,two") + Puppet.settings.stubs(:value).with(:environment).returns("one") + @node = Puppet::Node.new("testnode", :environment => "one") + @node.merge "two" => "three" + @node.parameters["environment"].should == "one" + end + + it "should not set the environment if it is already set in the parameters" do + Puppet.settings.stubs(:value).with(:environments).returns("one,two") + Puppet.settings.stubs(:value).with(:environment).returns("one") + @node = Puppet::Node.new("testnode", :environment => "one") + @node.merge "environment" => "two" + @node.parameters["environment"].should == "two" + end end describe Puppet::Node, " when indirecting" do diff --git a/vendor/gems/rspec/bin/spec b/vendor/gems/rspec/bin/spec index a7e6ce0cb..a7e6ce0cb 100644..100755 --- a/vendor/gems/rspec/bin/spec +++ b/vendor/gems/rspec/bin/spec |