Class: Vagrant::Provisioners::Chef
- Inherits:
-
Base
- Object
- Base
- Vagrant::Provisioners::Chef
show all
- Defined in:
- lib/vagrant/provisioners/chef.rb,
lib/vagrant/provisioners/chef.rb,
lib/vagrant/provisioners/chef.rb
Overview
This class is a base class where the common functionality shared between
chef-solo and chef-client provisioning are stored. This is not an actual
provisioner. Instead, ChefSolo or ChefServer should be used.
Defined Under Namespace
Classes: ChefError, Config
Instance Attribute Summary
Attributes inherited from Base
#action_env, #config
Instance Method Summary
collapse
Methods inherited from Base
#env, #initialize, #provision!, register, registered, #vm
Instance Method Details
#chown_provisioning_folder ⇒ Object
19
20
21
22
23
24
|
# File 'lib/vagrant/provisioners/chef.rb', line 19
def chown_provisioning_folder
vm.ssh.execute do |ssh|
ssh.sudo!("mkdir -p #{config.provisioning_path}")
ssh.sudo!("chown #{env.config.ssh.username} #{config.provisioning_path}")
end
end
|
#prepare ⇒ Object
7
8
9
|
# File 'lib/vagrant/provisioners/chef.rb', line 7
def prepare
raise ChefError, :invalid_provisioner
end
|
#setup_config(template, filename, template_vars) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/vagrant/provisioners/chef.rb', line 26
def setup_config(template, filename, template_vars)
config_file = TemplateRenderer.render(template, {
:log_level => config.log_level.to_sym,
:http_proxy => config.http_proxy,
:http_proxy_user => config.http_proxy_user,
:http_proxy_pass => config.http_proxy_pass,
:https_proxy => config.https_proxy,
:https_proxy_user => config.https_proxy_user,
:https_proxy_pass => config.https_proxy_pass,
:no_proxy => config.no_proxy
}.merge(template_vars))
vm.ssh.upload!(StringIO.new(config_file), File.join(config.provisioning_path, filename))
end
|
#setup_json ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/vagrant/provisioners/chef.rb', line 41
def setup_json
env.ui.info I18n.t("vagrant.provisioners.chef.json")
data = {
:config => env.config.to_hash,
:directory => env.config.vm.shared_folders["v-root"][:guestpath],
}
data = { :vagrant => data }
data.merge!(config.json)
json = data.to_json
vm.ssh.upload!(StringIO.new(json), File.join(config.provisioning_path, "dna.json"))
end
|
#verify_binary(binary) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/vagrant/provisioners/chef.rb', line 11
def verify_binary(binary)
vm.ssh.execute do |ssh|
ssh.sudo!("which #{binary}", :error_class => ChefError, :_key => :chef_not_detected, :binary => binary)
end
end
|