Provide a method to specify a Chef environment in a Vagrantfile.
This commit is contained in:
parent
e7e9dc5c4d
commit
5f751d5a77
|
@ -14,6 +14,7 @@ module Vagrant
|
|||
attr_accessor :client_key_path
|
||||
attr_accessor :file_cache_path
|
||||
attr_accessor :file_backup_path
|
||||
attr_accessor :environment
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
@ -22,6 +23,7 @@ module Vagrant
|
|||
@client_key_path = "/etc/chef/client.pem"
|
||||
@file_cache_path = "/srv/chef/file_store"
|
||||
@file_backup_path = "/srv/chef/cache"
|
||||
@environment = "_default"
|
||||
end
|
||||
|
||||
def validate(errors)
|
||||
|
@ -71,7 +73,8 @@ module Vagrant
|
|||
:validation_key => guest_validation_key_path,
|
||||
:client_key => config.client_key_path,
|
||||
:file_cache_path => config.file_cache_path,
|
||||
:file_backup_path => config.file_backup_path
|
||||
:file_backup_path => config.file_backup_path,
|
||||
:environment => config.environment
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -13,6 +13,10 @@ client_key "<%= client_key %>"
|
|||
file_cache_path "<%= file_cache_path %>"
|
||||
file_backup_path "<%= file_backup_path %>"
|
||||
|
||||
<% unless environment == "_default" %>
|
||||
environment "<%= environment %>"
|
||||
<% end %>
|
||||
|
||||
pid_file "/var/run/chef/chef-client.pid"
|
||||
|
||||
Mixlib::Log::Formatter.show_time = true
|
||||
|
|
|
@ -161,7 +161,8 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
|
|||
:validation_key => @action.guest_validation_key_path,
|
||||
:client_key => @config.client_key_path,
|
||||
:file_cache_path => @config.file_cache_path,
|
||||
:file_backup_path => @config.file_backup_path
|
||||
:file_backup_path => @config.file_backup_path,
|
||||
:environment => @config.environment
|
||||
})
|
||||
|
||||
@action.setup_server_config
|
||||
|
|
Loading…
Reference in New Issue