Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/puppet/application/filebucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ def help
information and the bucket located at the '$bucketdir' setting
by default.

* --server_list:
A list of comma seperated servers; only the first entry is used for file storage.
This setting takes precidence over `server`.

* --server:
The server to send the file to, instead of locally.
The server to use for file storage. This setting is only used if `server_list`
is not set.

* --todate:
(list only) Select bucket files until 'todate'.
Expand Down
20 changes: 12 additions & 8 deletions lib/puppet/type/filebucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,23 @@ module Puppet
end

newparam(:server) do
desc "The server providing the remote filebucket service. Defaults to the
value of the `server` setting (that is, the currently configured
puppet master server).
desc "The server providing the remote filebucket service.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if I should add any indication of the logic the indirector goes through to return a server to use


This setting is _only_ consulted if the `path` attribute is set to `false`."
defaultto { Puppet[:server] }
This setting is _only_ consulted if the `path` attribute is set to `false`.

If this attribute is not specified, the first entry in the `server_list`
configuration setting is used, followed by the value of the `server` setting
if `server_list` is not set."
end

newparam(:port) do
desc "The port on which the remote server is listening. Defaults to the
value of the `masterport` setting, which is usually %s." % Puppet[:masterport]
desc "The port on which the remote server is listening.

This setting is _only_ consulted if the `path` attribute is set to `false`.

defaultto { Puppet[:masterport] }
If this attribute is not specified, the first entry in the `server_list`
configuration setting is used, followed by the value of the `masterport`
setting if `server_list` is not set."
end

newparam(:path) do
Expand Down
14 changes: 8 additions & 6 deletions spec/unit/type/filebucket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
expect(Puppet::Type.type(:filebucket).new(:name => "main")[:path]).to eq(Puppet[:clientbucketdir])
end

it "should use the masterport as the path by default port" do
it "should not have a default port" do
Puppet.settings[:masterport] = 50
expect(Puppet::Type.type(:filebucket).new(:name => "main")[:port]).to eq(Puppet[:masterport])
expect(Puppet::Type.type(:filebucket).new(:name => "main")[:port]).to eq(nil)
end

it "should use the server as the path by default server" do
it "should not have a default server" do
Puppet.settings[:server] = "myserver"
expect(Puppet::Type.type(:filebucket).new(:name => "main")[:server]).to eq(Puppet[:server])
expect(Puppet::Type.type(:filebucket).new(:name => "main")[:server]).to eq(nil)
end

it "be local by default" do
Expand Down Expand Up @@ -93,10 +93,12 @@ def bucket(hash)
bucket.bucket
end

it "should use the default server if the path is unset and no server is provided" do
it "should not try to guess server or port if the path is unset and no server is provided" do
Puppet.settings[:server] = "myserv"
Puppet.settings[:server_list] = ['server_list_0', 'server_list_1']
Puppet::FileBucket::Dipper.expects(:new).with(:Server => nil, :Port => nil).returns @bucket

bucket = Puppet::Type.type(:filebucket).new :name => "main", :path => false
Puppet::FileBucket::Dipper.expects(:new).with { |args| args[:Server] == "myserv" }.returns @bucket
bucket.bucket
end
end
Expand Down