Proper error message if invalid provisioner is used [GH-1515]
This commit is contained in:
parent
0272db698b
commit
361cc1ae40
|
@ -1,6 +1,8 @@
|
|||
## 1.1.5 (unreleased)
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- Proper error message if invalid provisioner is used. [GH-1515]
|
||||
|
||||
## 1.1.4 (March 25, 2013)
|
||||
|
||||
|
|
|
@ -312,6 +312,12 @@ module VagrantPlugins
|
|||
|
||||
# Validate provisioners
|
||||
@provisioners.each do |vm_provisioner|
|
||||
if vm_provisioner.invalid?
|
||||
errors["vm"] << I18n.t("vagrant.config.vm.provisioner_not_found",
|
||||
:name => vm_provisioner.name)
|
||||
next
|
||||
end
|
||||
|
||||
if vm_provisioner.config
|
||||
provisioner_errors = vm_provisioner.config.validate(machine)
|
||||
if provisioner_errors
|
||||
|
|
|
@ -20,12 +20,14 @@ module VagrantPlugins
|
|||
@logger.debug("Provisioner defined: #{name}")
|
||||
|
||||
@config = nil
|
||||
@invalid = false
|
||||
@name = name
|
||||
|
||||
# Attempt to find the configuration class for this provider
|
||||
# if it exists and load the configuration.
|
||||
config_class = Vagrant.plugin("2").manager.provisioner_configs[@name]
|
||||
if !config_class
|
||||
@invalid = true
|
||||
@logger.info("Provisioner config for '#{@name}' not found. Ignoring config.")
|
||||
return
|
||||
end
|
||||
|
@ -35,6 +37,14 @@ module VagrantPlugins
|
|||
block.call(@config) if block
|
||||
@config.finalize!
|
||||
end
|
||||
|
||||
# Returns whether the provisioner used was invalid or not. A provisioner
|
||||
# is invalid if it can't be found.
|
||||
#
|
||||
# @return [Boolean]
|
||||
def invalid?
|
||||
@invalid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -472,15 +472,13 @@ en:
|
|||
Forwarded port '%{host}' (host port) is declared multiple times
|
||||
network_fp_requires_ports: |-
|
||||
Forwarded port definitions require a "host" and "guest" value
|
||||
provisioner_not_found: |-
|
||||
The '%{name}' provisioner could not be found.
|
||||
shared_folder_hostpath_missing: |-
|
||||
The host path of the shared folder is missing: %{path}
|
||||
shared_folder_nfs_owner_group: |-
|
||||
Shared folder that have NFS enabled do no support owner/group
|
||||
attributes. Host path: %{path}
|
||||
provisioner_not_found: "The provisioner '%{shortcut}' doesn't exist."
|
||||
provisioner_invalid_class: |-
|
||||
The provisioner '%{shortcut}' must inherit from
|
||||
`Vagrant::Plugin::V1::Provisioner`."
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Translations for commands. e.g. `vagrant x`
|
||||
|
|
Loading…
Reference in New Issue