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
@__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
# the block iteration for merging/overwriting
strategy = name
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
tuples.each do |s, b|
# 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
DESC
config(:local_exec, :push) do
config(:"local-exec", :push) do
require File.expand_path("../config", __FILE__)
init!
Config
end
push(:local_exec) do
push(:"local-exec") do
require File.expand_path("../push", __FILE__)
init!
Push

View File

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