diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-07-18 15:34:44 +0200 |
|---|---|---|
| committer | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-07-18 15:34:44 +0200 |
| commit | 8bbd8b4bb295fee7ad99f6137c9851528f1729cc (patch) | |
| tree | 2b9739774718813a0c32836e2ba9d2b15b4fd19b /spec | |
| parent | effaf80ae662076e3578c3eb7a18b863ef104bb4 (diff) | |
| download | puppet-8bbd8b4bb295fee7ad99f6137c9851528f1729cc.tar.gz puppet-8bbd8b4bb295fee7ad99f6137c9851528f1729cc.tar.xz puppet-8bbd8b4bb295fee7ad99f6137c9851528f1729cc.zip | |
Fix #2424 - File server can't find module in environment
Actually, the issue is:
* when the web server gets the request, it creates an indirection
request, filling attributes like ip or node from the HTTP request.
To do this, all the interesting attributes are given in a hash
(called options, see P::I::Request#new).
Once the request is properly initialized the options hash doesn't
contain the ip or node information (see set_attributes)
* the request is then transmitted to the file_serving layer,
which happily wants to use the node attribute to find environments or
perform authorization.
Unfortunately it fetches the node value from the request options hash,
not the request itself.
Since this node information is empty, puppet fails to find the
proper mount point, and fails the download.
This change makes sure we pass all the way down the node and fix
the authorization check.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/file_serving/configuration.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/indirector/file_server.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/unit/file_serving/configuration.rb b/spec/unit/file_serving/configuration.rb index 60515bf1e..9545f01cc 100755 --- a/spec/unit/file_serving/configuration.rb +++ b/spec/unit/file_serving/configuration.rb @@ -150,7 +150,7 @@ describe Puppet::FileServing::Configuration do @config = Puppet::FileServing::Configuration.create @config.stubs(:find_mount) - @request = stub 'request', :key => "foo/bar/baz", :options => {} + @request = stub 'request', :key => "foo/bar/baz", :options => {}, :node => nil end it "should reread the configuration" do @@ -179,7 +179,7 @@ describe Puppet::FileServing::Configuration do it "should use the mount name and node to find the mount" do @config.expects(:find_mount).with { |name, node| name == "foo" and node == "mynode" } - @request.options[:node] = "mynode" + @request.stubs(:node).returns("mynode") @config.split_path(@request) end diff --git a/spec/unit/indirector/file_server.rb b/spec/unit/indirector/file_server.rb index a80f5aed3..7dab320c1 100755 --- a/spec/unit/indirector/file_server.rb +++ b/spec/unit/indirector/file_server.rb @@ -241,8 +241,8 @@ describe Puppet::Indirector::FileServer do @mount = stub 'mount' @configuration.expects(:split_path).with(@request).returns([@mount, "rel/path"]) - @request.options[:node] = "mynode" - @request.options[:ipaddress] = "myip" + @request.stubs(:node).returns("mynode") + @request.stubs(:ip).returns("myip") @mount.expects(:allowed?).with("mynode", "myip").returns "something" @file_server.authorized?(@request).should == "something" |
