diff options
| author | Jacob Helwig <jacob@puppetlabs.com> | 2011-05-03 15:27:03 -0700 |
|---|---|---|
| committer | Jacob Helwig <jacob@puppetlabs.com> | 2011-05-03 15:27:03 -0700 |
| commit | fded269b8b2487184f7cfc409c3e82daa59f595a (patch) | |
| tree | ebbc45317aea603dd9f587955b7c2ac60e7bd253 | |
| parent | b17b49c97380cd64e75ac5e2ef12fb939ae953bb (diff) | |
| parent | 5569fad994978224dd24df9974ed731a409d11de (diff) | |
| download | puppet-fded269b8b2487184f7cfc409c3e82daa59f595a.tar.gz puppet-fded269b8b2487184f7cfc409c3e82daa59f595a.tar.xz puppet-fded269b8b2487184f7cfc409c3e82daa59f595a.zip | |
Merge branch 'tickets/2.7.x/7117-authconf-should-respect-environments' into 2.7.x
* tickets/2.7.x/7117-authconf-should-respect-environments:
(#7117) Return the environment as a Puppet::Node::Environment in uri2indirection
| -rw-r--r-- | lib/puppet/network/http/api/v1.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/network/http/api/v1_spec.rb | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb index 61307f01e..388d54961 100644 --- a/lib/puppet/network/http/api/v1.rb +++ b/lib/puppet/network/http/api/v1.rb @@ -30,7 +30,7 @@ module Puppet::Network::HTTP::API::V1 method = indirection_method(http_method, indirection) - params[:environment] = environment + params[:environment] = Puppet::Node::Environment.new(environment) raise ArgumentError, "No request key specified in #{uri}" if key == "" or key.nil? diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index bd95071c1..a952f24e2 100755 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -31,7 +31,7 @@ describe Puppet::Network::HTTP::API::V1 do end it "should use the first field of the URI as the environment" do - @tester.uri2indirection("GET", "/env/foo/bar", {})[3][:environment].should == "env" + @tester.uri2indirection("GET", "/env/foo/bar", {})[3][:environment].to_s.should == "env" end it "should fail if the environment is not alphanumeric" do @@ -39,7 +39,11 @@ describe Puppet::Network::HTTP::API::V1 do end it "should use the environment from the URI even if one is specified in the parameters" do - @tester.uri2indirection("GET", "/env/foo/bar", {:environment => "otherenv"})[3][:environment].should == "env" + @tester.uri2indirection("GET", "/env/foo/bar", {:environment => "otherenv"})[3][:environment].to_s.should == "env" + end + + it "should return the environment as a Puppet::Node::Environment" do + @tester.uri2indirection("GET", "/env/foo/bar", {})[3][:environment].should be_a Puppet::Node::Environment end it "should use the second field of the URI as the indirection name" do |
