Preserve returning environment after machine action gets called

This commit is contained in:
Brian Cain 2018-03-29 11:44:53 -07:00
parent 48b7c682ad
commit 616b0f9ba6
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
1 changed files with 3 additions and 1 deletions

View File

@ -188,7 +188,7 @@ module Vagrant
locker = @env.method(:lock) if lock && !name.to_s.start_with?("ssh")
# Lock this machine for the duration of this action
locker.call("machine-action-#{id}") do
return_env = locker.call("machine-action-#{id}") do
# Get the callable from the provider.
callable = @provider.action(name)
@ -208,6 +208,8 @@ module Vagrant
end
@triggers.fire_triggers(name, :after, @name.to_s)
# preserve returning environment after machine action runs
return return_env
rescue Errors::EnvironmentLockedError
raise Errors::MachineActionLockedError,
action: name,