From d783b33fe292334ad080e01859bdc1b5d396067f Mon Sep 17 00:00:00 2001 From: Collin Allen Date: Fri, 5 Apr 2013 09:40:32 -0700 Subject: [PATCH] Validate that extra_vars is a hash --- plugins/provisioners/ansible/config.rb | 7 +++++++ templates/locales/en.yml | 1 + 2 files changed, 8 insertions(+) diff --git a/plugins/provisioners/ansible/config.rb b/plugins/provisioners/ansible/config.rb index 3d3395e5e..b789733d5 100644 --- a/plugins/provisioners/ansible/config.rb +++ b/plugins/provisioners/ansible/config.rb @@ -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) diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 3c243604d..ebc9f683d 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -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"