Logging output reviewed (closes #2)

This commit is contained in:
Fabio Rehm 2013-03-11 00:13:48 -03:00
parent 03f823130c
commit 4de5411a67
5 changed files with 13 additions and 11 deletions

View file

@ -3,6 +3,7 @@ module Vagrant
module Action module Action
class Destroy < BaseAction class Destroy < BaseAction
def call(env) def call(env)
env[:ui].info I18n.t("vagrant.actions.vm.destroy.destroying")
env[:machine].provider.container.destroy env[:machine].provider.container.destroy
env[:machine].id = nil env[:machine].id = nil
@app.call env @app.call env

View file

@ -12,15 +12,9 @@ module Vagrant
end end
def call(env) def call(env)
# We _could_ extract the rootfs to a folder under ~/.vagrant.d/boxes env[:ui].info I18n.t("vagrant.actions.vm.import.importing",
# but it would open up for a few issues: :name => env[:machine].box.name)
# * The rootfs owner is the root user, so we'd need to prepend "sudo" to
# `vagrant box remove`
# * We'd waste a lot of disk space: a compressed Ubuntu rootfs fits 80mb,
# extracted it takes 262mb
# * If something goes wrong during the Container creation process and
# somehow we don't handle, writing to /tmp means that things will get
# flushed on next reboot
rootfs_cache = Dir.mktmpdir(TEMP_PREFIX) rootfs_cache = Dir.mktmpdir(TEMP_PREFIX)
box = env[:machine].box box = env[:machine].box
template_name = "vagrant-#{box.name}" template_name = "vagrant-#{box.name}"

View file

@ -44,7 +44,7 @@ module Vagrant
end end
def add_start_opts def add_start_opts
@env[:ui].info I18n.t("vagrant.actions.vm.share_folders.creating") @env[:ui].info I18n.t("vagrant.actions.lxc.share_folders.preparing")
folders = [] folders = []
shared_folders.each do |id, data| shared_folders.each do |id, data|
@ -53,6 +53,8 @@ module Vagrant
:hostpath => File.expand_path(data[:hostpath], @env[:root_path]), :hostpath => File.expand_path(data[:hostpath], @env[:root_path]),
:guestpath => data[:guestpath] :guestpath => data[:guestpath]
} }
@env[:ui].info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
:guest_path => data[:guestpath]))
end end
config = @env[:machine].provider_config config = @env[:machine].provider_config
@env[:machine].provider.container.share_folders(folders, config) @env[:machine].provider.container.share_folders(folders, config)

View file

@ -1,5 +1,10 @@
en: en:
vagrant: vagrant:
actions:
lxc:
share_folders:
preparing: Setting up mount entries for shared folders...
errors: errors:
lxc_execute_error: |- lxc_execute_error: |-
There was an error executing %{command} There was an error executing %{command}

View file

@ -9,7 +9,7 @@ describe Vagrant::LXC::Action::HandleBoxMetadata do
let(:box_directory) { Pathname.new('/path/to/box') } let(:box_directory) { Pathname.new('/path/to/box') }
let(:machine) { mock(:machine, box: box) } let(:machine) { mock(:machine, box: box) }
let(:app) { mock(:app, call: true) } let(:app) { mock(:app, call: true) }
let(:env) { {machine: machine} } let(:env) { {machine: machine, ui: stub(info: true)} }
let(:tmpdir) { '/tmp/rootfs/dir' } let(:tmpdir) { '/tmp/rootfs/dir' }
subject { described_class.new(app, env) } subject { described_class.new(app, env) }