From 3c47f4f3bc418f71e934f05bbc5b78a483a8d192 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 27 Feb 2013 21:29:33 -0800 Subject: [PATCH] SetHostname middleware uses hostname --- .../providers/virtualbox/action/host_name.rb | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/providers/virtualbox/action/host_name.rb diff --git a/plugins/providers/virtualbox/action/host_name.rb b/plugins/providers/virtualbox/action/host_name.rb new file mode 100644 index 000000000..6c02085aa --- /dev/null +++ b/plugins/providers/virtualbox/action/host_name.rb @@ -0,0 +1,21 @@ +module VagrantPlugins + module ProviderVirtualBox + module Action + class HostName + def initialize(app, env) + @app = app + end + + def call(env) + @app.call(env) + + host_name = env[:machine].config.vm.hostname + if !host_name.nil? + env[:ui].info I18n.t("vagrant.actions.vm.host_name.setting") + env[:machine].guest.change_host_name(host_name) + end + end + end + end + end +end