Validate that extra_vars is a hash

This commit is contained in:
Collin Allen 2013-04-05 09:40:32 -07:00
parent 5949f256bd
commit d783b33fe2
2 changed files with 8 additions and 0 deletions

View File

@ -49,6 +49,13 @@ module VagrantPlugins
end
end
# Validate that extra_vars is a hash, if set
if extra_vars
if not extra_vars.kind_of?(Hash)
errors << I18n.t("vagrant.provisioners.ansible.extra_vars_not_hash")
end
end
# Validate the existence of the inventory_file, if specified
if inventory_file
expanded_path = Pathname.new(inventory_file).expand_path(machine.env.root_path)

View File

@ -1051,3 +1051,4 @@ en:
no_playbook: "`playbook` must be set for the Ansible provisioner."
playbook_path_invalid: "`playbook` for the Ansible provisioner does not exist on the host system: %{path}"
inventory_file_path_invalid: "`inventory_file` for the Ansible provisioner does not exist on the host system: %{path}"
extra_vars_not_hash: "`extra_vars` for the Ansible provisioner must be a hash"