From 4638b8e0a0f7edc0a760313cb4acd2db4f11a383 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Thu, 20 Dec 2012 16:54:09 -0800 Subject: [CHEF-3715] rm moneta's config options Cache for syntax check is configured by syntax_check_cache_path. For compatibility, the old moneta-specific cache_options[:path] will be used when syntax_check_cache_path is not set (defaults to nil) --- lib/chef/config.rb | 16 ++++++++++++---- lib/chef/cookbook/syntax_check.rb | 8 +++++--- lib/chef/knife/configure.rb | 3 +-- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/chef/config.rb b/lib/chef/config.rb index 74b10a4250..d05692ddc8 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -48,9 +48,6 @@ class Chef end def self.platform_specific_path(path) - #10.times { puts "* " * 40} - #pp caller - if RUBY_PLATFORM =~ /mswin|mingw|windows/ # turns /etc/chef/client.rb into C:/chef/client.rb system_drive = ENV['SYSTEMDRIVE'] ? ENV['SYSTEMDRIVE'] : "" @@ -309,7 +306,18 @@ class Chef # Start handlers start_handlers [] - # Checksum Cache + # Syntax Check Cache. Knife keeps track of files that is has already syntax + # checked by storing files in this directory. `syntax_check_cache_path` is + # the new (and preferred) configuration setting. If not set, knife will + # fall back to using cache_options[:path]. + # + # Because many users will have knife configs with cache_options (generated + # by `knife configure`), the default for now is to *not* set + # syntax_check_cache_path, and thus fallback to cache_options[:path]. We + # leave that value to the same default as was previously set. + syntax_check_cache_path nil + + # Deprecated: cache_options({ :path => platform_specific_path("/var/chef/cache/checksums") }) # Set to false to silence Chef 11 deprecation warnings: diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb index 2ba62e568e..d656f96ebd 100644 --- a/lib/chef/cookbook/syntax_check.rb +++ b/lib/chef/cookbook/syntax_check.rb @@ -39,9 +39,11 @@ class Chef # Create a new PersistentSet. Values in the set are persisted by # creating a file in the +cache_path+ directory. If not given, the - # value of Chef::Config[:cache_options][:path] is used. - def initialize(cache_path=Chef::Config[:cache_options][:path]) - @cache_path = cache_path + # value of Chef::Config[:syntax_check_cache_path] is used; if that + # value is not configured, the value of + # Chef::Config[:cache_options][:path] is used. + def initialize(cache_path=nil) + @cache_path = cache_path || Chef::Config[:syntax_check_cache_path] || Chef::Config[:cache_options][:path] @cache_path_created = false end diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb index 0be7093e29..e818239a89 100644 --- a/lib/chef/knife/configure.rb +++ b/lib/chef/knife/configure.rb @@ -81,8 +81,7 @@ client_key '#{new_client_key}' validation_client_name '#{validation_client_name}' validation_key '#{validation_key}' chef_server_url '#{chef_server}' -cache_type 'BasicFile' -cache_options( :path => '#{File.join(chef_config_path, "checksums")}' ) +syntax_check_cache_path '#{File.join(chef_config_path, "syntax_check_cache")}' EOH unless chef_repo.empty? f.puts "cookbook_path [ '#{chef_repo}/cookbooks' ]" -- cgit v1.2.1