Class: Vagrant::Provisioners::ChefServer::Config

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

Instance Attribute Summary collapse

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

#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

Attributes inherited from Config::Base

#top

Instance Method Summary collapse

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

#add_recipe, #add_role, #instance_variables_hash, #run_list, #run_list=

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.



16
17
18
19
20
21
# File 'lib/vagrant/provisioners/chef_server.rb', line 16

def initialize
  super

  @validation_client_name = "chef-validator"
  @client_key_path = "/etc/chef/client.pem"
end

Instance Attribute Details

#chef_server_urlObject

Returns the value of attribute chef_server_url.



11
12
13
# File 'lib/vagrant/provisioners/chef_server.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_server.rb', line 14

def client_key_path
  @client_key_path
end

#validation_client_nameObject

Returns the value of attribute validation_client_name.



13
14
15
# File 'lib/vagrant/provisioners/chef_server.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_server.rb', line 12

def validation_key_path
  @validation_key_path
end

Instance Method Details

#validate(errors) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/vagrant/provisioners/chef_server.rb', line 23

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 json[:run_list] && run_list.empty?
end