kernel/v2: fix push strategy config lookup

This commit is contained in:
Mitchell Hashimoto 2014-12-12 01:36:39 -08:00
parent 669c9fc013
commit 84ae22e976
3 changed files with 11 additions and 20 deletions

View File

@ -21,18 +21,18 @@ module VagrantPlugins
# Compile all the provider configurations # Compile all the provider configurations
@__defined_pushes.each do |name, tuples| @__defined_pushes.each do |name, tuples|
# Find the configuration class for this push
config_class = Vagrant.plugin("2").manager.push_configs[name]
config_class ||= Vagrant::Config::V2::DummyConfig
# Load it up
config = config_class.new
# Capture the strategy so we can use it later. This will be used in # Capture the strategy so we can use it later. This will be used in
# the block iteration for merging/overwriting # the block iteration for merging/overwriting
strategy = name strategy = name
strategy = tuples[0][0] if tuples[0] strategy = tuples[0][0] if tuples[0]
# Find the configuration class for this push
config_class = Vagrant.plugin("2").manager.push_configs[strategy]
config_class ||= Vagrant::Config::V2::DummyConfig
# Load it up
config = config_class.new
begin begin
tuples.each do |s, b| tuples.each do |s, b|
# Update the strategy if it has changed, reseting the current # Update the strategy if it has changed, reseting the current

View File

@ -8,13 +8,13 @@ module VagrantPlugins
Run a local command or script to push Run a local command or script to push
DESC DESC
config(:local_exec, :push) do config(:"local-exec", :push) do
require File.expand_path("../config", __FILE__) require File.expand_path("../config", __FILE__)
init! init!
Config Config
end end
push(:local_exec) do push(:"local-exec") do
require File.expand_path("../push", __FILE__) require File.expand_path("../push", __FILE__)
init! init!
Push Push

View File

@ -1,6 +1,6 @@
require "fileutils" require "fileutils"
require "tempfile" require "tempfile"
require "vagrant/util/subprocess" require "vagrant/util/safe_exec"
require_relative "errors" require_relative "errors"
@ -38,16 +38,7 @@ module VagrantPlugins
# Execute the script, raising an exception if it fails. # Execute the script, raising an exception if it fails.
def execute!(*cmd) def execute!(*cmd)
result = Vagrant::Util::Subprocess.execute(*cmd) Vagrant::Util::SafeExec.exec(cmd[0], *cmd[1..-1])
if result.exit_code != 0
raise Errors::CommandFailed,
cmd: cmd.join(" "),
stdout: result.stdout,
stderr: result.stderr
end
result
end end
end end
end end