Provide defaults in a proper way for Chef config

This commit is contained in:
Mitchell Hashimoto 2012-01-19 20:47:01 -08:00
parent 28eddafa56
commit f87c25bac8
3 changed files with 19 additions and 18 deletions

View File

@ -115,11 +115,11 @@ module Vagrant
attr_accessor :attempts
attr_writer :run_list
def initialize
@attempts = 1
@json = {}
@log_level = :info
end
# Provide defaults in such a way that they won't override the instance
# variable. This is so merging continues to work properly.
def attempts; @attempts || 1; end
def json; @json ||= {}; end
def log_level; @log_level || :info; end
# This returns the json that is merged with the defaults and the
# user set data.

View File

@ -18,15 +18,13 @@ module Vagrant
attr_accessor :encrypted_data_bag_secret_key_path
attr_accessor :encrypted_data_bag_secret
def initialize
super
@validation_client_name = "chef-validator"
@client_key_path = "/etc/chef/client.pem"
@file_cache_path = "/srv/chef/file_store"
@file_backup_path = "/srv/chef/cache"
@encrypted_data_bag_secret = "/tmp/encrypted_data_bag_secret"
end
# Provide defaults in such a way that they won't override the instance
# variable. This is so merging continues to work properly.
def validation_client_name; @validation_client_name || "chef-validator"; end
def client_key_path; @client_key_path || "/etc/chef/client.pem"; end
def file_cache_path; @file_cache_path || "/srv/chef/file_store"; end
def file_backup_path; @file_backup_path || "/srv/chef/cache"; end
def encrypted_data_bag_secret; @encrypted_data_bag_secret || "/tmp/encrypted_data_bag_secret"; end
def validate(env, errors)
super

View File

@ -16,11 +16,14 @@ module Vagrant
attr_accessor :recipe_url
attr_accessor :nfs
def initialize
super
# Provide defaults in such a way that they won't override the instance
# variable. This is so merging continues to work properly.
def cookbooks_path
@cookbooks_path || ["cookbooks", [:vm, "cookbooks"]]
end
@cookbooks_path = ["cookbooks", [:vm, "cookbooks"]]
@nfs = false
def nfs
@nfs || false
end
def validate(env, errors)