Class: Vagrant::Provisioners::ChefClient::Config

Inherits:
Vagrant::Provisioners::Chef::Config show all
Defined in:
lib/vagrant/provisioners/chef_client.rb

Instance Attribute Summary collapse

Attributes inherited from Vagrant::Provisioners::Chef::Config

#binary_env, #binary_path, #http_proxy, #http_proxy_pass, #http_proxy_user, #https_proxy, #https_proxy_pass, #https_proxy_user, #json, #log_level, #no_proxy, #node_name, #provisioning_path, #run_list

Attributes inherited from Config::Base

#top

Instance Method Summary collapse

Methods inherited from Vagrant::Provisioners::Chef::Config

#add_recipe, #add_role, #instance_variables_hash, #merged_json

Methods inherited from Config::Base

configures, #env, #instance_variables_hash, json_create, #set_options, #to_hash, #to_json

Constructor Details

#initializeConfig

Returns a new instance of Config.



21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant/provisioners/chef_client.rb', line 21

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_key_path = nil
  @encrypted_data_bag_secret = "/etc/chef/encrypted_data_bag_secret"
end

Instance Attribute Details

#chef_server_urlObject

Returns the value of attribute chef_server_url.



11
12
13
# File 'lib/vagrant/provisioners/chef_client.rb', line 11

def chef_server_url
  @chef_server_url
end

#client_key_pathObject

Returns the value of attribute client_key_path.



14
15
16
# File 'lib/vagrant/provisioners/chef_client.rb', line 14

def client_key_path
  @client_key_path
end

#encrypted_data_bag_secretObject

Returns the value of attribute encrypted_data_bag_secret.



19
20
21
# File 'lib/vagrant/provisioners/chef_client.rb', line 19

def encrypted_data_bag_secret
  @encrypted_data_bag_secret
end

#encrypted_data_bag_secret_key_pathObject

Returns the value of attribute encrypted_data_bag_secret_key_path.



18
19
20
# File 'lib/vagrant/provisioners/chef_client.rb', line 18

def encrypted_data_bag_secret_key_path
  @encrypted_data_bag_secret_key_path
end

#environmentObject

Returns the value of attribute environment.



17
18
19
# File 'lib/vagrant/provisioners/chef_client.rb', line 17

def environment
  @environment
end

#file_backup_pathObject

Returns the value of attribute file_backup_path.



16
17
18
# File 'lib/vagrant/provisioners/chef_client.rb', line 16

def file_backup_path
  @file_backup_path
end

#file_cache_pathObject

Returns the value of attribute file_cache_path.



15
16
17
# File 'lib/vagrant/provisioners/chef_client.rb', line 15

def file_cache_path
  @file_cache_path
end

#validation_client_nameObject

Returns the value of attribute validation_client_name.



13
14
15
# File 'lib/vagrant/provisioners/chef_client.rb', line 13

def validation_client_name
  @validation_client_name
end

#validation_key_pathObject

Returns the value of attribute validation_key_path.



12
13
14
# File 'lib/vagrant/provisioners/chef_client.rb', line 12

def validation_key_path
  @validation_key_path
end

Instance Method Details

#validate(errors) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/vagrant/provisioners/chef_client.rb', line 32

def validate(errors)
  super

  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.run_list_empty")) if @run_list && @run_list.empty?
end