Class: Vagrant::Provisioners::Chef::ChefConfig
- Inherits:
-
Config::Base
- Object
- Config::Base
- Vagrant::Provisioners::Chef::ChefConfig
- Defined in:
- lib/vagrant/provisioners/chef.rb
Overview
This is the configuration which is available through ‘config.chef`
Instance Attribute Summary collapse
-
#chef_server_url ⇒ Object
Chef server specific config.
-
#client_key_path ⇒ Object
Returns the value of attribute client_key_path.
-
#cookbooks_path ⇒ Object
Chef solo specific config.
-
#json ⇒ Object
Returns the value of attribute json.
-
#provisioning_path ⇒ Object
Shared config.
-
#role_path ⇒ Object
Returns the value of attribute role_path.
-
#validation_client_name ⇒ Object
Returns the value of attribute validation_client_name.
-
#validation_key_path ⇒ Object
Returns the value of attribute validation_key_path.
Attributes inherited from Config::Base
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.
-
#initialize ⇒ ChefConfig
constructor
A new instance of ChefConfig.
-
#run_list ⇒ Object
Returns the run list for the provisioning.
-
#run_list=(value) ⇒ Object
Sets the run list to the specified value.
- #to_json ⇒ Object
Methods inherited from Config::Base
Constructor Details
#initialize ⇒ ChefConfig
Returns a new instance of ChefConfig.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vagrant/provisioners/chef.rb', line 23 def initialize @validation_client_name = "chef-validator" @client_key_path = "/etc/chef/client.pem" @cookbooks_path = "cookbooks" @provisioning_path = "/tmp/vagrant-chef" @json = { :instance_role => "vagrant", :run_list => ["recipe[vagrant_main]"] } end |
Instance Attribute Details
#chef_server_url ⇒ Object
Chef server specific config
10 11 12 |
# File 'lib/vagrant/provisioners/chef.rb', line 10 def chef_server_url @chef_server_url end |
#client_key_path ⇒ Object
Returns the value of attribute client_key_path.
13 14 15 |
# File 'lib/vagrant/provisioners/chef.rb', line 13 def client_key_path @client_key_path end |
#cookbooks_path ⇒ Object
Chef solo specific config
16 17 18 |
# File 'lib/vagrant/provisioners/chef.rb', line 16 def cookbooks_path @cookbooks_path end |
#json ⇒ Object
Returns the value of attribute json.
21 22 23 |
# File 'lib/vagrant/provisioners/chef.rb', line 21 def json @json end |
#provisioning_path ⇒ Object
Shared config
20 21 22 |
# File 'lib/vagrant/provisioners/chef.rb', line 20 def provisioning_path @provisioning_path end |
#role_path ⇒ Object
Returns the value of attribute role_path.
17 18 19 |
# File 'lib/vagrant/provisioners/chef.rb', line 17 def role_path @role_path end |
#validation_client_name ⇒ Object
Returns the value of attribute validation_client_name.
12 13 14 |
# File 'lib/vagrant/provisioners/chef.rb', line 12 def validation_client_name @validation_client_name end |
#validation_key_path ⇒ Object
Returns the value of attribute validation_key_path.
11 12 13 |
# File 'lib/vagrant/provisioners/chef.rb', line 11 def validation_key_path @validation_key_path end |
Instance Method Details
#add_recipe(name) ⇒ Object
Adds a recipe to the run list
46 47 48 49 |
# File 'lib/vagrant/provisioners/chef.rb', line 46 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
52 53 54 55 |
# File 'lib/vagrant/provisioners/chef.rb', line 52 def add_role(name) name = "role[#{name}]" unless name =~ /^role\[(.+?)\]$/ run_list << name end |
#run_list ⇒ Object
Returns the run list for the provisioning
36 37 38 |
# File 'lib/vagrant/provisioners/chef.rb', line 36 def run_list json[:run_list] end |
#run_list=(value) ⇒ Object
Sets the run list to the specified value
41 42 43 |
# File 'lib/vagrant/provisioners/chef.rb', line 41 def run_list=(value) json[:run_list] = value end |
#to_json ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/vagrant/provisioners/chef.rb', line 57 def to_json # Overridden so that the 'json' key could be removed, since its just # merged into the config anyways data = instance_variables_hash data.delete(:json) data.to_json end |