Chef JSON can be set directly with `json =` instead of the old `merge!` trick. [closes GH-314]
This commit is contained in:
parent
c2bccdc65a
commit
9287324472
|
@ -14,6 +14,8 @@
|
||||||
behavior. [GH-323]
|
behavior. [GH-323]
|
||||||
- Forward agent and forward X11 settings properly appear in
|
- Forward agent and forward X11 settings properly appear in
|
||||||
`ssh_config` output. [GH-105]
|
`ssh_config` output. [GH-105]
|
||||||
|
- Chef JSON can now be set with `chef.json =` instead of the old
|
||||||
|
`merge` technique. [GH-314]
|
||||||
|
|
||||||
## 0.7.6 (July 2, 2011)
|
## 0.7.6 (July 2, 2011)
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ module Vagrant
|
||||||
|
|
||||||
# Merge with the "extra data" which isn't put under the
|
# Merge with the "extra data" which isn't put under the
|
||||||
# vagrant namespace by default
|
# vagrant namespace by default
|
||||||
data.merge!(config.json)
|
data.merge!(config.merged_json)
|
||||||
|
|
||||||
json = data.to_json
|
json = data.to_json
|
||||||
|
|
||||||
|
@ -90,11 +90,12 @@ module Vagrant
|
||||||
attr_accessor :no_proxy
|
attr_accessor :no_proxy
|
||||||
attr_accessor :binary_path
|
attr_accessor :binary_path
|
||||||
attr_accessor :binary_env
|
attr_accessor :binary_env
|
||||||
|
attr_accessor :run_list
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@provisioning_path = "/tmp/vagrant-chef"
|
@provisioning_path = "/tmp/vagrant-chef"
|
||||||
@log_level = :info
|
@log_level = :info
|
||||||
@json = { :instance_role => "vagrant" }
|
@json = {}
|
||||||
@http_proxy = nil
|
@http_proxy = nil
|
||||||
@http_proxy_user = nil
|
@http_proxy_user = nil
|
||||||
@http_proxy_pass = nil
|
@http_proxy_pass = nil
|
||||||
|
@ -104,16 +105,15 @@ module Vagrant
|
||||||
@no_proxy = nil
|
@no_proxy = nil
|
||||||
@binary_path = nil
|
@binary_path = nil
|
||||||
@binary_env = nil
|
@binary_env = nil
|
||||||
|
@run_list = []
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the run list for the provisioning
|
# This returns the json that is merged with the defaults and the
|
||||||
def run_list
|
# user set data.
|
||||||
json[:run_list] ||= []
|
def merged_json
|
||||||
end
|
{ :instance_role => "vagrant",
|
||||||
|
:run_list => run_list
|
||||||
# Sets the run list to the specified value
|
}.merge(json || {})
|
||||||
def run_list=(value)
|
|
||||||
json[:run_list] = value
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adds a recipe to the run list
|
# Adds a recipe to the run list
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Vagrant
|
||||||
|
|
||||||
errors.add(I18n.t("vagrant.config.chef.server_url_empty")) if !chef_server_url || chef_server_url.strip == ""
|
errors.add(I18n.t("vagrant.config.chef.server_url_empty")) if !chef_server_url || chef_server_url.strip == ""
|
||||||
errors.add(I18n.t("vagrant.config.chef.validation_key_path")) if !validation_key_path
|
errors.add(I18n.t("vagrant.config.chef.validation_key_path")) if !validation_key_path
|
||||||
errors.add(I18n.t("vagrant.config.chef.run_list_empty")) if json[:run_list] && run_list.empty?
|
errors.add(I18n.t("vagrant.config.chef.run_list_empty")) if run_list && run_list.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ module Vagrant
|
||||||
super
|
super
|
||||||
|
|
||||||
errors.add(I18n.t("vagrant.config.chef.cookbooks_path_empty")) if !cookbooks_path || [cookbooks_path].flatten.empty?
|
errors.add(I18n.t("vagrant.config.chef.cookbooks_path_empty")) if !cookbooks_path || [cookbooks_path].flatten.empty?
|
||||||
errors.add(I18n.t("vagrant.config.chef.run_list_empty")) if !json[:run_list] || run_list.empty?
|
errors.add(I18n.t("vagrant.config.chef.run_list_empty")) if !run_list || run_list.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue