Class: Vagrant::Provisioners::Chef::Config

Inherits:
Config::Base show all
Defined in:
lib/vagrant/provisioners/chef.rb

Overview

This is the configuration which is available through config.chef

Instance Attribute Summary collapse

Attributes inherited from Config::Base

#top

Instance Method Summary collapse

Methods inherited from Config::Base

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

Constructor Details

#initializeConfig

Returns a new instance of Config.



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/vagrant/provisioners/chef.rb', line 85

def initialize
  @provisioning_path = "/tmp/vagrant-chef"
  @log_level = :info
  @json = { :instance_role => "vagrant" }
  @http_proxy = nil
  @http_proxy_user = nil
  @http_proxy_pass = nil
  @https_proxy = nil
  @https_proxy_user = nil
  @https_proxy_pass = nil
  @no_proxy = nil
end

Instance Attribute Details

#http_proxyObject

Returns the value of attribute http_proxy.



77
78
79
# File 'lib/vagrant/provisioners/chef.rb', line 77

def http_proxy
  @http_proxy
end

#http_proxy_passObject

Returns the value of attribute http_proxy_pass.



79
80
81
# File 'lib/vagrant/provisioners/chef.rb', line 79

def http_proxy_pass
  @http_proxy_pass
end

#http_proxy_userObject

Returns the value of attribute http_proxy_user.



78
79
80
# File 'lib/vagrant/provisioners/chef.rb', line 78

def http_proxy_user
  @http_proxy_user
end

#https_proxyObject

Returns the value of attribute https_proxy.



80
81
82
# File 'lib/vagrant/provisioners/chef.rb', line 80

def https_proxy
  @https_proxy
end

#https_proxy_passObject

Returns the value of attribute https_proxy_pass.



82
83
84
# File 'lib/vagrant/provisioners/chef.rb', line 82

def https_proxy_pass
  @https_proxy_pass
end

#https_proxy_userObject

Returns the value of attribute https_proxy_user.



81
82
83
# File 'lib/vagrant/provisioners/chef.rb', line 81

def https_proxy_user
  @https_proxy_user
end

#jsonObject

Returns the value of attribute json.



76
77
78
# File 'lib/vagrant/provisioners/chef.rb', line 76

def json
  @json
end

#log_levelObject

Returns the value of attribute log_level.



75
76
77
# File 'lib/vagrant/provisioners/chef.rb', line 75

def log_level
  @log_level
end

#no_proxyObject

Returns the value of attribute no_proxy.



83
84
85
# File 'lib/vagrant/provisioners/chef.rb', line 83

def no_proxy
  @no_proxy
end

#node_nameObject

Shared config



73
74
75
# File 'lib/vagrant/provisioners/chef.rb', line 73

def node_name
  @node_name
end

#provisioning_pathObject

Returns the value of attribute provisioning_path.



74
75
76
# File 'lib/vagrant/provisioners/chef.rb', line 74

def provisioning_path
  @provisioning_path
end

Instance Method Details

#add_recipe(name) ⇒ Object

Adds a recipe to the run list



109
110
111
112
# File 'lib/vagrant/provisioners/chef.rb', line 109

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



115
116
117
118
# File 'lib/vagrant/provisioners/chef.rb', line 115

def add_role(name)
  name = "role[#{name}]" unless name =~ /^role\[(.+?)\]$/
  run_list << name
end

#instance_variables_hashObject



120
121
122
123
124
125
126
# File 'lib/vagrant/provisioners/chef.rb', line 120

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

#run_listObject

Returns the run list for the provisioning



99
100
101
# File 'lib/vagrant/provisioners/chef.rb', line 99

def run_list
  json[:run_list] ||= []
end

#run_list=(value) ⇒ Object

Sets the run list to the specified value



104
105
106
# File 'lib/vagrant/provisioners/chef.rb', line 104

def run_list=(value)
  json[:run_list] = value
end