Class: Vagrant::Provisioners::Chef::Config
- Inherits:
-
Config::Base
- Object
- Config::Base
- Vagrant::Provisioners::Chef::Config
- Defined in:
- lib/vagrant/provisioners/chef.rb
Overview
This is the configuration which is available through config.chef
Direct Known Subclasses
Vagrant::Provisioners::ChefClient::Config, Vagrant::Provisioners::ChefSolo::Config
Instance Attribute Summary collapse
-
#attempts ⇒ Object
Provide defaults in such a way that they won't override the instance variable.
-
#binary_env ⇒ Object
Returns the value of attribute binary_env.
-
#binary_path ⇒ Object
Returns the value of attribute binary_path.
-
#http_proxy ⇒ Object
Returns the value of attribute http_proxy.
-
#http_proxy_pass ⇒ Object
Returns the value of attribute http_proxy_pass.
-
#http_proxy_user ⇒ Object
Returns the value of attribute http_proxy_user.
-
#https_proxy ⇒ Object
Returns the value of attribute https_proxy.
-
#https_proxy_pass ⇒ Object
Returns the value of attribute https_proxy_pass.
-
#https_proxy_user ⇒ Object
Returns the value of attribute https_proxy_user.
-
#json ⇒ Object
Returns the value of attribute json.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#no_proxy ⇒ Object
Returns the value of attribute no_proxy.
-
#node_name ⇒ Object
Shared config.
-
#provisioning_path ⇒ Object
Returns the value of attribute provisioning_path.
-
#run_list ⇒ Object
Returns the run list, but also sets it up to be empty if it hasn't been defined already.
Instance Method Summary collapse
-
#add_recipe(name) ⇒ Object
Adds a recipe to the run list.
-
#add_role(name) ⇒ Object
Adds a role to the run list.
- #instance_variables_hash ⇒ Object
-
#merged_json ⇒ Object
This returns the json that is merged with the defaults and the user set data.
- #validate(env, errors) ⇒ Object
Methods inherited from Config::Base
json_create, #merge, #set_options, #to_hash, #to_json
Instance Attribute Details
#attempts ⇒ Object
Provide defaults in such a way that they won't override the instance variable. This is so merging continues to work properly.
122 123 124 |
# File 'lib/vagrant/provisioners/chef.rb', line 122 def attempts @attempts end |
#binary_env ⇒ Object
Returns the value of attribute binary_env.
116 117 118 |
# File 'lib/vagrant/provisioners/chef.rb', line 116 def binary_env @binary_env end |
#binary_path ⇒ Object
Returns the value of attribute binary_path.
115 116 117 |
# File 'lib/vagrant/provisioners/chef.rb', line 115 def binary_path @binary_path end |
#http_proxy ⇒ Object
Returns the value of attribute http_proxy.
108 109 110 |
# File 'lib/vagrant/provisioners/chef.rb', line 108 def http_proxy @http_proxy end |
#http_proxy_pass ⇒ Object
Returns the value of attribute http_proxy_pass.
110 111 112 |
# File 'lib/vagrant/provisioners/chef.rb', line 110 def http_proxy_pass @http_proxy_pass end |
#http_proxy_user ⇒ Object
Returns the value of attribute http_proxy_user.
109 110 111 |
# File 'lib/vagrant/provisioners/chef.rb', line 109 def http_proxy_user @http_proxy_user end |
#https_proxy ⇒ Object
Returns the value of attribute https_proxy.
111 112 113 |
# File 'lib/vagrant/provisioners/chef.rb', line 111 def https_proxy @https_proxy end |
#https_proxy_pass ⇒ Object
Returns the value of attribute https_proxy_pass.
113 114 115 |
# File 'lib/vagrant/provisioners/chef.rb', line 113 def https_proxy_pass @https_proxy_pass end |
#https_proxy_user ⇒ Object
Returns the value of attribute https_proxy_user.
112 113 114 |
# File 'lib/vagrant/provisioners/chef.rb', line 112 def https_proxy_user @https_proxy_user end |
#json ⇒ Object
Returns the value of attribute json.
107 108 109 |
# File 'lib/vagrant/provisioners/chef.rb', line 107 def json @json end |
#log_level ⇒ Object
Returns the value of attribute log_level.
106 107 108 |
# File 'lib/vagrant/provisioners/chef.rb', line 106 def log_level @log_level end |
#no_proxy ⇒ Object
Returns the value of attribute no_proxy.
114 115 116 |
# File 'lib/vagrant/provisioners/chef.rb', line 114 def no_proxy @no_proxy end |
#node_name ⇒ Object
Shared config
104 105 106 |
# File 'lib/vagrant/provisioners/chef.rb', line 104 def node_name @node_name end |
#provisioning_path ⇒ Object
Returns the value of attribute provisioning_path.
105 106 107 |
# File 'lib/vagrant/provisioners/chef.rb', line 105 def provisioning_path @provisioning_path end |
#run_list ⇒ Object
Returns the run list, but also sets it up to be empty if it hasn't been defined already.
136 137 138 |
# File 'lib/vagrant/provisioners/chef.rb', line 136 def run_list @run_list ||= [] end |
Instance Method Details
#add_recipe(name) ⇒ Object
Adds a recipe to the run list
141 142 143 144 |
# File 'lib/vagrant/provisioners/chef.rb', line 141 def add_recipe(name) name = "recipe[#{name}]" unless name =~ /^recipe\[(.+?)\]$/ run_list << name end |
#add_role(name) ⇒ Object
Adds a role to the run list
147 148 149 150 |
# File 'lib/vagrant/provisioners/chef.rb', line 147 def add_role(name) name = "role[#{name}]" unless name =~ /^role\[(.+?)\]$/ run_list << name end |
#instance_variables_hash ⇒ Object
158 159 160 161 162 163 164 |
# File 'lib/vagrant/provisioners/chef.rb', line 158 def instance_variables_hash # Overridden so that the 'json' key could be removed, since its just # merged into the config anyways result = super result.delete("json") result end |
#merged_json ⇒ Object
This returns the json that is merged with the defaults and the user set data.
128 129 130 131 132 |
# File 'lib/vagrant/provisioners/chef.rb', line 128 def merged_json original = { :instance_role => "vagrant" } original[:run_list] = @run_list if @run_list original.merge(json || {}) end |
#validate(env, errors) ⇒ Object
152 153 154 155 156 |
# File 'lib/vagrant/provisioners/chef.rb', line 152 def validate(env, errors) super errors.add(I18n.t("vagrant.config.chef.vagrant_as_json_key")) if json.has_key?(:vagrant) end |