Turn network, provider, and provisioner names into symbols if not

This commit is contained in:
Mitchell Hashimoto 2013-03-15 22:14:04 -07:00
parent 6e7427ca4d
commit 9a29cecfdf
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,8 @@ IMPROVEMENTS:
are avoided. [GH-1418] are avoided. [GH-1418]
- An error will be shown if you forward a port to the same host port - An error will be shown if you forward a port to the same host port
multiple times. multiple times.
- Automatically convert network, provider, and provisioner names to
symbols internally in case people define them as strings.
BUG FIXES: BUG FIXES:

View File

@ -138,19 +138,20 @@ module VagrantPlugins
end end
# Merge in the latest settings and set the internal state # Merge in the latest settings and set the internal state
@__networks[id] = [type, options] @__networks[id] = [type.to_sym, options]
end end
# Configures a provider for this VM. # Configures a provider for this VM.
# #
# @param [Symbol] name The name of the provider. # @param [Symbol] name The name of the provider.
def provider(name, &block) def provider(name, &block)
name = name.to_sym
@__providers[name] ||= [] @__providers[name] ||= []
@__providers[name] << block if block_given? @__providers[name] << block if block_given?
end end
def provision(name, options=nil, &block) def provision(name, options=nil, &block)
@provisioners << VagrantConfigProvisioner.new(name, options, &block) @provisioners << VagrantConfigProvisioner.new(name.to_sym, options, &block)
end end
def defined_vms def defined_vms