[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:31:56 UTC 2010
The following commit has been merged in the upstream branch:
commit 744295d1058e640b778bdac39202c97adbc59c9f
Author: Luke Kanies <luke at reductivelabs.com>
Date: Wed Jan 27 10:19:09 2010 -0800
Allowing Environment.new to take an environment
This can happen because we're almost always converting
to environment instances from strings.
Shouldn't happen often, but it's easier to be more failure-tolerant.
Signed-off-by: Luke Kanies <luke at reductivelabs.com>
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index 7041744..d1a126a 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -27,6 +27,7 @@ class Puppet::Node::Environment
# Return an existing environment instance, or create a new one.
def self.new(name = nil)
+ return name if name.is_a?(self)
name ||= Puppet.settings.value(:environment)
raise ArgumentError, "Environment name must be specified" unless name
diff --git a/spec/unit/node/environment.rb b/spec/unit/node/environment.rb
index ac542d0..d0db250 100755
--- a/spec/unit/node/environment.rb
+++ b/spec/unit/node/environment.rb
@@ -43,6 +43,11 @@ describe Puppet::Node::Environment do
Puppet::Node::Environment.new(:one).to_s.should == "one"
end
+ it "should just return any provided environment if an environment is provided as the name" do
+ one = Puppet::Node::Environment.new(:one)
+ Puppet::Node::Environment.new(one).should equal(one)
+ end
+
describe "when managing known resource types" do
before do
@env = Puppet::Node::Environment.new("dev")
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list