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
class Destroy < BaseAction
def call(env)
env[:ui].info I18n.t("vagrant.actions.vm.destroy.destroying")
env[:machine].provider.container.destroy
env[:machine].id = nil
@app.call env

View file

@ -12,15 +12,9 @@ module Vagrant
end
def call(env)
# We _could_ extract the rootfs to a folder under ~/.vagrant.d/boxes
# but it would open up for a few issues:
# * 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
env[:ui].info I18n.t("vagrant.actions.vm.import.importing",
:name => env[:machine].box.name)
rootfs_cache = Dir.mktmpdir(TEMP_PREFIX)
box = env[:machine].box
template_name = "vagrant-#{box.name}"

View file

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

View file

@ -1,5 +1,10 @@
en:
vagrant:
actions:
lxc:
share_folders:
preparing: Setting up mount entries for shared folders...
errors:
lxc_execute_error: |-
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(:machine) { mock(:machine, box: box) }
let(:app) { mock(:app, call: true) }
let(:env) { {machine: machine} }
let(:env) { {machine: machine, ui: stub(info: true)} }
let(:tmpdir) { '/tmp/rootfs/dir' }
subject { described_class.new(app, env) }