From 546e0f98e3c6bfcb35163d1c6c19e0b4cb02e230 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 21 Jul 2011 11:40:00 -0700 Subject: Remove Puppet::Util::Cacher usage from Puppet::Util::Settings The path attribute was being unnecessarily cached. The value is a LoadedFile instance, which already knows how to check whether it needs to be reloaded. The act of reparsing was being triggered separately from the cacher mechanism. The comment indicated this value was only being cached so it could be easily cleared for tests, but it wasn't being cleared for tests. Thus, there is no reason for this attribute to be cached, so remove it. Reviewed-By: Jacob Helwig (cherry picked from commit bdcb9be3b5d7cd54548cbeb7b13bee6fe4e730f7) --- lib/puppet/util/settings.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/puppet/util/settings.rb') diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 4559e9af3..caaf61b7b 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -2,13 +2,11 @@ require 'puppet' require 'sync' require 'getoptlong' require 'puppet/external/event-loop' -require 'puppet/util/cacher' require 'puppet/util/loadedfile' # The class for handling configuration files. class Puppet::Util::Settings include Enumerable - include Puppet::Util::Cacher require 'puppet/util/settings/setting' require 'puppet/util/settings/file_setting' @@ -401,11 +399,10 @@ class Puppet::Util::Settings } end - # Cache this in an easily clearable way, since we were - # having trouble cleaning it up after tests. - cached_attr(:file) do + def file + return @file if @file if path = self[:config] and FileTest.exist?(path) - Puppet::Util::LoadedFile.new(path) + @file = Puppet::Util::LoadedFile.new(path) end end -- cgit From 47058abc0c5647d59b0dd21181e67dbfdd908292 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 18 Aug 2011 10:35:50 -0700 Subject: (#8662) Skip user and group resources when applying settings on Windows When running as root, puppet will generate a catalog from its settings to create the various directories, e.g. var, ssl. If mkusers is true and a setting implements owner and/or group methods, then puppet will automatically add user and group resources to the catalog (provided the user name is not root and the group names are not root or wheel). This functionality will not be supported on Windows, and so this step is skipped. --- lib/puppet/util/settings.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/puppet/util/settings.rb') diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index caaf61b7b..3039a7b0a 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -780,6 +780,7 @@ if @config.include?(:run_mode) # Create the transportable objects for users and groups. def add_user_resources(catalog, sections) return unless Puppet.features.root? + return if Puppet.features.microsoft_windows? return unless self[:mkusers] @config.each do |name, setting| -- cgit