Convert provisioners and systems to I18n

This commit is contained in:
Mitchell Hashimoto 2010-08-27 21:02:11 -07:00
parent eee7ced10b
commit 12ce76ffd0
5 changed files with 17 additions and 8 deletions

View File

@ -85,7 +85,6 @@ module Vagrant
end end
def chown_provisioning_folder def chown_provisioning_folder
env.ui.info "Setting permissions on chef provisioning folder..."
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
ssh.exec!("sudo mkdir -p #{env.config.chef.provisioning_path}") ssh.exec!("sudo mkdir -p #{env.config.chef.provisioning_path}")
ssh.exec!("sudo chown #{env.config.ssh.username} #{env.config.chef.provisioning_path}") ssh.exec!("sudo chown #{env.config.ssh.username} #{env.config.chef.provisioning_path}")
@ -97,12 +96,11 @@ module Vagrant
:log_level => env.config.chef.log_level.to_sym :log_level => env.config.chef.log_level.to_sym
}.merge(template_vars)) }.merge(template_vars))
env.ui.info "Uploading chef configuration script..."
vm.ssh.upload!(StringIO.new(config_file), File.join(env.config.chef.provisioning_path, filename)) vm.ssh.upload!(StringIO.new(config_file), File.join(env.config.chef.provisioning_path, filename))
end end
def setup_json def setup_json
env.ui.info "Generating chef JSON and uploading..." env.ui.info "vagrant.provisioners.chef.json"
# Set up initial configuration # Set up initial configuration
data = { data = {

View File

@ -26,7 +26,7 @@ module Vagrant
end end
def create_client_key_folder def create_client_key_folder
env.ui.info "Creating folder to hold client key..." env.ui.info "vagrant.provisioners.chef.client_key_folder"
path = Pathname.new(env.config.chef.client_key_path) path = Pathname.new(env.config.chef.client_key_path)
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
@ -35,7 +35,7 @@ module Vagrant
end end
def upload_validation_key def upload_validation_key
env.ui.info "Uploading chef client validation key..." env.ui.info "vagrant.provisioners.chef.upload_validation_key"
vm.ssh.upload!(validation_key_path, guest_validation_key_path) vm.ssh.upload!(validation_key_path, guest_validation_key_path)
end end
@ -52,7 +52,7 @@ module Vagrant
def run_chef_client def run_chef_client
command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-client -c client.rb -j dna.json" command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-client -c client.rb -j dna.json"
env.ui.info "Running chef-client..." env.ui.info "vagrant.provisioners.chef.running_client"
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
ssh.exec!(command) do |channel, type, data| ssh.exec!(command) do |channel, type, data|
if type == :exit_status if type == :exit_status

View File

@ -40,7 +40,7 @@ module Vagrant
def run_chef_solo def run_chef_solo
command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-solo -c solo.rb -j dna.json" command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-solo -c solo.rb -j dna.json"
env.ui.info "Running chef-solo..." env.ui.info "vagrant.provisioners.chef.running_solo"
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
ssh.exec!(command) do |channel, type, data| ssh.exec!(command) do |channel, type, data|
ssh.check_exit_status(data, command) if type == :exit_status ssh.check_exit_status(data, command) if type == :exit_status

View File

@ -29,7 +29,7 @@ module Vagrant
# Overridden methods # Overridden methods
#------------------------------------------------------------------- #-------------------------------------------------------------------
def halt def halt
vm.env.ui.info "Attempting graceful shutdown of linux..." vm.env.ui.info "vagrant.systems.linux.attempting_halt"
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
ssh.exec!("sudo halt") ssh.exec!("sudo halt")
end end

View File

@ -189,3 +189,14 @@ en:
nfs_export: nfs_export:
prepare: "Preparing to edit /etc/exports. Administrator priveleges will be required..." prepare: "Preparing to edit /etc/exports. Administrator priveleges will be required..."
provisioners:
chef:
json: "Generating chef JSON and uploading..."
client_key_folder: "Creating folder to hold client key..."
upload_validation_key: "Uploading chef client validation key..."
running_client: "Running chef-client..."
running_solo: "Running chef-solo..."
systems:
linux:
attempting_halt: "Attempting graceful shutdown of linux..."