From 9eef19f5e205fe8f0628d5a33143d442da44b10e Mon Sep 17 00:00:00 2001 From: Dmitry Tyzhnenko Date: Tue, 25 Apr 2017 01:41:35 +0300 Subject: [PATCH] Add machine params to environment --- lib/vagrant-host-shell/provisioner.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/vagrant-host-shell/provisioner.rb b/lib/vagrant-host-shell/provisioner.rb index 791ca1d..5a514f5 100644 --- a/lib/vagrant-host-shell/provisioner.rb +++ b/lib/vagrant-host-shell/provisioner.rb @@ -7,13 +7,17 @@ def provision config.inline, :notify => [:stdout, :stderr], :workdir => config.cwd, - :env => {PATH: ENV["VAGRANT_OLD_ENV_PATH"]}, + :env => { + PATH: ENV["VAGRANT_OLD_ENV_PATH"], + MACHINE_HOST: @machine.ssh_info[:host], + MACHINE_PORT: @machine.ssh_info[:port], + MACHINE_USERNAME: @machine.ssh_info[:username]}, ) do |io_name, data| @machine.env.ui.info "[#{io_name}] #{data}" end - if config.abort_on_nonzero && !result.exit_code.zero? - raise VagrantPlugins::HostShell::Errors::NonZeroStatusError.new(config.inline, result.exit_code) + if config.abort_on_nonzero && !result.exit_code.zero? + raise VagrantPlugins::HostShell::Errors::NonZeroStatusError.new(config.inline, result.exit_code) end end