Permalink
Browse files

[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)
  • Loading branch information...
1 parent 2c460c1 commit 4638b8e0a0f7edc0a760313cb4acd2db4f11a383 @danielsdeleo danielsdeleo committed Dec 21, 2012
@@ -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`:
View
@@ -48,9 +48,6 @@ def self.inspect
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 @@ def self.formatters
# 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:
@@ -39,9 +39,11 @@ class PersistentSet
# 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
@@ -81,8 +81,7 @@ def run
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' ]"
@@ -17,8 +17,6 @@
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
@@ -125,12 +125,12 @@
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

0 comments on commit 4638b8e

Please sign in to comment.