From ce080e908f9a2fe351664e013285e9a8f1ba490d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 27 Aug 2010 21:09:50 -0700 Subject: [PATCH] Cleaned up most command string literals and SSH --- lib/vagrant/command/destroy.rb | 2 +- lib/vagrant/command/halt.rb | 2 +- lib/vagrant/command/provision.rb | 2 +- lib/vagrant/command/reload.rb | 2 +- lib/vagrant/command/resume.rb | 2 +- lib/vagrant/command/ssh.rb | 2 +- lib/vagrant/command/suspend.rb | 2 +- lib/vagrant/command/up.rb | 2 +- lib/vagrant/command/version.rb | 4 +++- lib/vagrant/ssh.rb | 1 - templates/locales/en.yml | 10 +++++++++- 11 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/vagrant/command/destroy.rb b/lib/vagrant/command/destroy.rb index e8c973d8f..3c4174eaf 100644 --- a/lib/vagrant/command/destroy.rb +++ b/lib/vagrant/command/destroy.rb @@ -9,7 +9,7 @@ module Vagrant if vm.created? vm.destroy else - vm.env.ui.info "VM not created. Moving on..." + vm.env.ui.info "vagrant.commands.common.vm_not_created" end end end diff --git a/lib/vagrant/command/halt.rb b/lib/vagrant/command/halt.rb index 64d291799..9e12d90db 100644 --- a/lib/vagrant/command/halt.rb +++ b/lib/vagrant/command/halt.rb @@ -10,7 +10,7 @@ module Vagrant if vm.created? vm.halt(options) else - vm.env.ui.info "VM not created. Moving on..." + vm.env.ui.info "vagrant.commands.common.vm_not_created" end end end diff --git a/lib/vagrant/command/provision.rb b/lib/vagrant/command/provision.rb index 9cd286ffb..576880c69 100644 --- a/lib/vagrant/command/provision.rb +++ b/lib/vagrant/command/provision.rb @@ -9,7 +9,7 @@ module Vagrant if vm.created? && vm.vm.running? vm.provision else - vm.env.ui.info "VM not created. Moving on..." + vm.env.ui.info "vagrant.commands.common.vm_not_created" end end end diff --git a/lib/vagrant/command/reload.rb b/lib/vagrant/command/reload.rb index 4b7c83194..7f3968fb4 100644 --- a/lib/vagrant/command/reload.rb +++ b/lib/vagrant/command/reload.rb @@ -9,7 +9,7 @@ module Vagrant if vm.created? vm.reload else - vm.env.ui.info "VM not created. Moving on..." + vm.env.ui.info "vagrant.commands.common.vm_not_created" end end end diff --git a/lib/vagrant/command/resume.rb b/lib/vagrant/command/resume.rb index 1c1cdf6e3..f9af2ca90 100644 --- a/lib/vagrant/command/resume.rb +++ b/lib/vagrant/command/resume.rb @@ -9,7 +9,7 @@ module Vagrant if vm.created? vm.resume else - vm.env.ui.info "VM not created. Moving on..." + vm.env.ui.info "vagrant.commands.common.vm_not_created" end end end diff --git a/lib/vagrant/command/ssh.rb b/lib/vagrant/command/ssh.rb index d7405b2cd..d7978df70 100644 --- a/lib/vagrant/command/ssh.rb +++ b/lib/vagrant/command/ssh.rb @@ -17,7 +17,7 @@ module Vagrant def ssh_execute ssh_vm.ssh.execute do |ssh| - ssh_vm.env.ui.info "Execute: #{options[:execute]}" + ssh_vm.env.ui.info "vagrant.commands.ssh.execute", :command => options[:execute] ssh.exec!(options[:execute]) do |channel, type, data| ssh_vm.env.ui.info "#{data}" end diff --git a/lib/vagrant/command/suspend.rb b/lib/vagrant/command/suspend.rb index 7f46535ce..78e39b6e9 100644 --- a/lib/vagrant/command/suspend.rb +++ b/lib/vagrant/command/suspend.rb @@ -9,7 +9,7 @@ module Vagrant if vm.created? vm.suspend else - vm.env.ui.info "VM not created. Moving on..." + vm.env.ui.info "vagrant.commands.common.vm_not_created" end end end diff --git a/lib/vagrant/command/up.rb b/lib/vagrant/command/up.rb index 1522e6191..4e29f64cf 100644 --- a/lib/vagrant/command/up.rb +++ b/lib/vagrant/command/up.rb @@ -9,7 +9,7 @@ module Vagrant # TODO: Make the options[:provision] actually mean something target_vms.each do |vm| if vm.created? - vm.env.ui.info "VM already created. Booting if its not already running..." + vm.env.ui.info "vagrant.commands.up.vm_created" vm.start else vm.up diff --git a/lib/vagrant/command/version.rb b/lib/vagrant/command/version.rb index 31741b574..59d99a7f9 100644 --- a/lib/vagrant/command/version.rb +++ b/lib/vagrant/command/version.rb @@ -5,7 +5,9 @@ module Vagrant register "version", :alias => %w(-v --version) def version - env.ui.info "Vagrant version #{Vagrant::VERSION}" + env.ui.info("vagrant.commands.version.output", + :version => Vagrant::VERSION, + :_prefix => false) end end end diff --git a/lib/vagrant/ssh.rb b/lib/vagrant/ssh.rb index 2e07e43d5..2c3de79c3 100644 --- a/lib/vagrant/ssh.rb +++ b/lib/vagrant/ssh.rb @@ -115,7 +115,6 @@ module Vagrant stat = File.stat(key_path) if stat.owned? && file_perms(key_path) != "600" - env.ui.info "Permissions on private key incorrect, fixing..." File.chmod(0600, key_path) raise Errors::SSHKeyBadPermissions.new(:key_path => key_path) if file_perms(key_path) != "600" diff --git a/templates/locales/en.yml b/templates/locales/en.yml index a749ba26f..acd697c31 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -58,8 +58,12 @@ en: # Translations for commands. e.g. `vagrant x` #------------------------------------------------------------------------------- commands: + common: + vm_not_created: "VM not created. Moving on..." box: - no_installed_boxes: There are no installed boxes! Use `vagrant box add` to add some. + no_installed_boxes: "There are no installed boxes! Use `vagrant box add` to add some." + ssh: + execute: "Execute: %{command}" status: output: |- Current VM states: @@ -81,6 +85,10 @@ en: This environment represents multiple VMs. The VMs are all listed above with their current state. For more information about a specific VM, run `vagrant status NAME`. + up: + vm_created: "VM already created. Booting if its not already running..." + version: + output: "Vagrant version %{version}" #------------------------------------------------------------------------------- # Translations for Vagrant middleware acions