Pushes are hashed by name, not strategy.

@mitchellh this is a partial revert of 84ae22e. It took me a little bit
to figure out why this broke everything, but then I finally realized it.

84ae22e changes the finalize! function to lookup pushes by strategy
type, but pushes are keyed by push strategy name. In other words, given:

    config.push.define("foo", strategy: "bar")

the `push_configs` has will look like:


    { :foo => [:bar, #<PushConfig>] }

This is important, because if we key by strategy, the user cannot 
specify the same push strategy more than once:

    config.push.define("foo", strategy: "bar")
    config.push.define("zip", strategy: "bar")

If we keyed off of the strategy, this would be impossible.
This commit is contained in:
Seth Vargo 2014-12-14 23:32:32 -05:00
parent f06703cdb1
commit 214a79e057
1 changed files with 6 additions and 6 deletions

View File

@ -21,18 +21,18 @@ module VagrantPlugins
# Compile all the provider configurations
@__defined_pushes.each do |name, tuples|
# 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.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]
begin
tuples.each do |s, b|
# Update the strategy if it has changed, reseting the current