diff --git a/lib/vagrant-lxc/action.rb b/lib/vagrant-lxc/action.rb index 30485cf..8d44320 100644 --- a/lib/vagrant-lxc/action.rb +++ b/lib/vagrant-lxc/action.rb @@ -11,6 +11,7 @@ require 'vagrant-lxc/action/forced_halt' require 'vagrant-lxc/action/forward_ports' require 'vagrant-lxc/action/handle_box_metadata' require 'vagrant-lxc/action/is_running' +require 'vagrant-lxc/action/message' require 'vagrant-lxc/action/setup_package_files' require 'vagrant-lxc/action/share_folders' diff --git a/lib/vagrant-lxc/action/message.rb b/lib/vagrant-lxc/action/message.rb new file mode 100644 index 0000000..3ad8581 --- /dev/null +++ b/lib/vagrant-lxc/action/message.rb @@ -0,0 +1,22 @@ +module Vagrant + module LXC + module Action + class Message + def initialize(app, env, msg_key, type = :info) + @app = app + @msg_key = msg_key + @type = type + end + + def call(env) + machine = env[:machine] + message = I18n.t("vagrant_lxc.messages.#{@msg_key}", name: machine.name) + + env[:ui].send @type, message + + @app.call env + end + end + end + end +end