The puppet install.rb script now defaults the config directory to %PROGRAMDATA%\PuppetLabs\puppet\etc on Windows. This is more inline with Windows best-practices, as this directory is used to store application data across all users. The PROGRAMDATA environment variable also takes into account alternate system drives, by using the SYSTEMDRIVE environment variable.
Note that the Dir::COMMON_APPDATA constant is so named because it corresponds to the CSIDL_COMMON_APPDATA constant, which on 2000, XP, and 2003 is %ALLUSERSPROFILE%\Application Data, and on Vista, Win7 and 2008 is %SYSTEMDRIVE%\ProgramData. This commit also updates puppet's default run_mode var and conf directories when running as "root" to match the install script, and fixes the spec test, which was looking in the Dir::WINDOWS directory. Reviewed-by: Cameron Thomas <came...@puppetlabs.com> Signed-off-by: Josh Cooper <j...@puppetlabs.com> --- Local-branch: ticket/master/8660-default-windows-install-paths install.rb | 3 +++ lib/puppet/util/run_mode.rb | 4 ++-- spec/unit/util/run_mode_spec.rb | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/install.rb b/install.rb index 784ec8c..03bcfa0 100755 --- a/install.rb +++ b/install.rb @@ -243,6 +243,9 @@ def prepare_installation if not InstallOptions.configdir.nil? configdir = InstallOptions.configdir + elsif $operatingsystem == "windows" + require 'win32/dir' + configdir = File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") else configdir = "/etc/puppet" end diff --git a/lib/puppet/util/run_mode.rb b/lib/puppet/util/run_mode.rb index 450cbf1..6028aef 100644 --- a/lib/puppet/util/run_mode.rb +++ b/lib/puppet/util/run_mode.rb @@ -27,14 +27,14 @@ module Puppet def conf_dir which_dir( - (Puppet.features.microsoft_windows? ? File.join(Dir::WINDOWS, "puppet", "etc") : "/etc/puppet"), + (Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") : "/etc/puppet"), "~/.puppet" ) end def var_dir which_dir( - (Puppet.features.microsoft_windows? ? File.join(Dir::WINDOWS, "puppet", "var") : "/var/lib/puppet"), + (Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var") : "/var/lib/puppet"), "~/.puppet/var" ) end diff --git a/spec/unit/util/run_mode_spec.rb b/spec/unit/util/run_mode_spec.rb index 5d9a3d0..f2303cc 100755 --- a/spec/unit/util/run_mode_spec.rb +++ b/spec/unit/util/run_mode_spec.rb @@ -8,7 +8,7 @@ describe Puppet::Util::RunMode do it "should have confdir /etc/puppet when run as root" do Puppet.features.stubs(:root?).returns(true) - etcdir = Puppet.features.microsoft_windows? ? File.join(Dir::WINDOWS, "puppet", "etc") : '/etc/puppet' + etcdir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") : '/etc/puppet' # REMIND: issue with windows backslashes @run_mode.conf_dir.should == File.expand_path(etcdir) end @@ -21,7 +21,7 @@ describe Puppet::Util::RunMode do it "should have vardir /var/lib/puppet when run as root" do Puppet.features.stubs(:root?).returns(true) - vardir = Puppet.features.microsoft_windows? ? File.join(Dir::WINDOWS, "puppet", "var") : '/var/lib/puppet' + vardir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var") : '/var/lib/puppet' # REMIND: issue with windows backslashes @run_mode.var_dir.should == File.expand_path(vardir) end -- 1.7.5.4 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.