Provide a method to specify a Chef environment in a Vagrantfile.

This commit is contained in:
Pat Collins 2011-05-10 15:48:43 -04:00 committed by Mitchell Hashimoto
parent e7e9dc5c4d
commit 5f751d5a77
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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