[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

Luke Kanies luke at madstop.com
Fri Jan 23 14:21:13 UTC 2009


The following commit has been merged in the master branch:
commit 67136f111c60779a1b87b43a6b949a2357399836
Author: Luke Kanies <luke at madstop.com>
Date:   Fri Oct 3 12:42:51 2008 -0500

    Fixing the Node class to no longer validate environments
    since #1614 removed that validation.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb
index 341ec77..e10299d 100644
--- a/lib/puppet/node.rb
+++ b/lib/puppet/node.rb
@@ -15,12 +15,7 @@ class Puppet::Node
 
     attr_accessor :name, :classes, :parameters, :source, :ipaddress
     attr_reader :time
-
-    # Set the environment, making sure that it's valid.
-    def environment=(value)
-        raise(ArgumentError, "Invalid environment %s" % value) unless Puppet::Node::Environment.valid?(value)
-        @environment = value
-    end
+    attr_writer :environment
 
     # Do not return environments that are the empty string, and use
     # explicitly set environments, then facts, then a central env
@@ -28,7 +23,6 @@ class Puppet::Node
     def environment
         unless @environment
             if env = parameters["environment"]
-                raise(ArgumentError, "Invalid environment %s from parameters" % env) unless Puppet::Node::Environment.valid?(env)
                 @environment = env
             else
                 @environment = Puppet::Node::Environment.new.name.to_s
diff --git a/spec/unit/node.rb b/spec/unit/node.rb
index c6d2e61..cd22149 100755
--- a/spec/unit/node.rb
+++ b/spec/unit/node.rb
@@ -49,11 +49,6 @@ describe Puppet::Node, "when initializing" do
         @node = Puppet::Node.new("testing", :environment => "myenv")
         @node.environment.should == "myenv"
     end
-
-    it "should validate the environment" do
-        Puppet.settings.stubs(:value).with(:environments).returns("myenv")
-        proc { Puppet::Node.new("testing", :environment => "other") }.should raise_error(ArgumentError)
-    end
 end
 
 describe Puppet::Node, "when returning the environment" do
@@ -73,16 +68,6 @@ describe Puppet::Node, "when returning the environment" do
         Puppet::Node::Environment.expects(:new).returns(env)
         @node.environment.should == "myenv"
     end
-
-    it "should fail if the parameter environment is invalid" do
-        @node.parameters = {"environment" => "three"}
-        proc { @node.environment }.should raise_error(ArgumentError)
-    end
-
-    it "should fail if the parameter environment is invalid" do
-        @node.parameters = {"environment" => "three"}
-        proc { @node.environment }.should raise_error(ArgumentError)
-    end
 end
 
 describe Puppet::Node, "when merging facts" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list