Fixed #1232 - the rundir no longer specifies a user/group,

and there are now client- and server-specific yaml directories.

Signed-off-by: Luke Kanies <luke@madstop.com>
This commit is contained in:
Luke Kanies 2008-07-03 17:27:11 -05:00
Родитель 7a6ae29962
Коммит ba12d3000d
5 изменённых файлов: 42 добавлений и 5 удалений

Просмотреть файл

@ -1,4 +1,7 @@
0.24.?
Fixed #1232 - the rundir no longer specifies a user/group,
and there are now client- and server-specific yaml directories.
Fixed #1006 - puppetrun --class works again. I added the class
membership testing to the Ldap node terminus, and added tests,
so it shouldn't break again.

Просмотреть файл

@ -69,8 +69,6 @@ module Puppet
:rundir => {
:default => rundir,
:mode => 01777,
:owner => "$user",
:group => "$group",
:desc => "Where Puppet PID files are kept."
},
:genconfig => [false,
@ -358,7 +356,9 @@ module Puppet
# To make sure this directory is created before we try to use it on the server, we need
# it to be in the server section (#1138).
:yamldir => {:default => "$vardir/yaml", :owner => "$user", :group => "$user", :mode => "750",
:desc => "The directory in which YAML data is stored, usually in a subdirectory."}
:desc => "The directory in which YAML data is stored, usually in a subdirectory."},
:clientyamldir => {:default => "$vardir/client_yaml", :mode => "750",
:desc => "The directory in which client-side YAML data is stored."}
)
self.setdefaults(:puppetd,

Просмотреть файл

@ -36,7 +36,8 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
# Return the path to a given node's file.
def path(name)
File.join(Puppet[:yamldir], self.class.indirection_name.to_s, name.to_s + ".yaml")
base = (Puppet[:name] == "puppetmasterd") ? Puppet[:yamldir] : Puppet[:clientyamldir]
File.join(base, self.class.indirection_name.to_s, name.to_s + ".yaml")
end
private

Просмотреть файл

@ -20,4 +20,24 @@ describe "Puppet defaults" do
lambda { Puppet.settings[:certname] = "Host.Domain.Com" }.should raise_error(ArgumentError)
end
end
it "should have a clientyamldir setting" do
Puppet.settings[:clientyamldir].should_not be_nil
end
it "should have different values for the yamldir and clientyamldir" do
Puppet.settings[:yamldir].should_not == Puppet.settings[:clientyamldir]
end
# See #1232
it "should not specify a user or group for the clientyamldir" do
Puppet.settings.element(:clientyamldir).owner.should be_nil
Puppet.settings.element(:clientyamldir).group.should be_nil
end
# See #1232
it "should not specify a user or group for the rundir" do
Puppet.settings.element(:rundir).owner.should be_nil
Puppet.settings.element(:rundir).group.should be_nil
end
end

Просмотреть файл

@ -20,12 +20,25 @@ describe Puppet::Indirector::Yaml, " when choosing file location" do
@subject.name = :me
@dir = "/what/ever"
Puppet.settings.stubs(:value).with(:yamldir).returns(@dir)
Puppet.settings.stubs(:value).returns("fakesettingdata")
Puppet.settings.stubs(:value).with(:clientyamldir).returns(@dir)
@request = stub 'request', :key => :me, :instance => @subject
end
describe Puppet::Indirector::Yaml, " when choosing file location" do
it "should use the yamldir if the process name is 'puppetmasterd'" do
Puppet.settings.expects(:value).with(:name).returns "puppetmasterd"
Puppet.settings.expects(:value).with(:yamldir).returns "/main/yaml/dir"
@store.path(:me).should =~ %r{^/main/yaml/dir}
end
it "should use the client yamldir if the process name is not 'puppetmasterd'" do
Puppet.settings.expects(:value).with(:name).returns "cient"
Puppet.settings.expects(:value).with(:clientyamldir).returns "/client/yaml/dir"
@store.path(:me).should =~ %r{^/client/yaml/dir}
end
it "should store all files in a single file root set in the Puppet defaults" do
@store.path(:me).should =~ %r{^#{@dir}}
end