diff options
author | danielsdeleo <dan@opscode.com> | 2012-12-20 16:54:09 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2012-12-21 12:15:18 -0800 |
commit | 4638b8e0a0f7edc0a760313cb4acd2db4f11a383 (patch) | |
tree | cfb59ab942207d27026c4116a514be870473816c | |
parent | 2c460c191bcdb1acfe6978a6e7e7ff8e0273f973 (diff) | |
download | chef-4638b8e0a0f7edc0a760313cb4acd2db4f11a383.tar.gz |
[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)
-rw-r--r-- | distro/common/markdown/man1/knife.mkd | 11 | ||||
-rw-r--r-- | lib/chef/config.rb | 16 | ||||
-rw-r--r-- | lib/chef/cookbook/syntax_check.rb | 8 | ||||
-rw-r--r-- | lib/chef/knife/configure.rb | 3 | ||||
-rw-r--r-- | spec/support/chef_helpers.rb | 2 | ||||
-rw-r--r-- | spec/unit/cookbook/syntax_check_spec.rb | 4 |
6 files changed, 23 insertions, 21 deletions
diff --git a/distro/common/markdown/man1/knife.mkd b/distro/common/markdown/man1/knife.mkd index 054e220cf9..8c97cc97e1 100644 --- a/distro/common/markdown/man1/knife.mkd +++ b/distro/common/markdown/man1/knife.mkd @@ -98,14 +98,9 @@ If the config file exists, knife uses these settings for __GENERAL OPTIONS__ def * `chef_server_url`: URL of the Chef server. Corresponds to the `-s` or `--server-url` option. This is requested from the user when running this sub-command. - * `cache_type`: - The type of cache to use. Default is BasicFile. This can be any type of - Cache that moneta supports: BasicFile, Berkeley, Couch, DataMapper, - File, LMC, Memcache, Memory, MongoDB, Redis, Rufus, S3, SDBM, Tyrant, - Xattr, YAML. - * `cache_options`: - Specifies various options to use for caching. These options are - dependent on the `cache_type`. + * `syntax_check_cache_path`: + Specifies the path to a directory where knife caches information + about files that it has syntax checked. * `validation_client_name`: Specifies the name of the client used to validate new clients. * `validation_key`: 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' ]" diff --git a/spec/support/chef_helpers.rb b/spec/support/chef_helpers.rb index 77cbe5b5cb..74af5f558e 100644 --- a/spec/support/chef_helpers.rb +++ b/spec/support/chef_helpers.rb @@ -17,8 +17,6 @@ CHEF_SPEC_DATA = File.expand_path(File.dirname(__FILE__) + "/../data/") CHEF_SPEC_BACKUP_PATH = File.join(Dir.tmpdir, 'test-backup-path') Chef::Config[:log_level] = :fatal -Chef::Config[:cache_type] = "Memory" -Chef::Config[:cache_options] = { } Chef::Config[:persistent_queue] = false Chef::Config[:file_backup_path] = CHEF_SPEC_BACKUP_PATH diff --git a/spec/unit/cookbook/syntax_check_spec.rb b/spec/unit/cookbook/syntax_check_spec.rb index b9cea935b5..4297751432 100644 --- a/spec/unit/cookbook/syntax_check_spec.rb +++ b/spec/unit/cookbook/syntax_check_spec.rb @@ -125,12 +125,12 @@ describe Chef::Cookbook::SyntaxCheck do let(:cache_path) { Dir.mktmpdir } before do - Chef::Config[:cache_options] = {:path => cache_path } + Chef::Config[:syntax_check_cache_path] = cache_path end after do FileUtils.rm_rf(cache_path) if File.exist?(cache_path) - Chef::Config[:cache_options] = {:path => nil } + Chef::Config[:syntax_check_cache_path] = nil end describe "and the files have not been syntax checked previously" do |