From dd3d78265940b5764ebcbacd8fcc007d19c37291 Mon Sep 17 00:00:00 2001 From: Eugenio Marzo Date: Wed, 12 Jul 2017 15:27:10 +0200 Subject: [PATCH] Added exception if chef.node_path is defined on Vagrantfile but the directory does not exist locally --- plugins/provisioners/chef/provisioner/chef_zero.rb | 7 +++++++ templates/locales/en.yml | 2 ++ 2 files changed, 9 insertions(+) diff --git a/plugins/provisioners/chef/provisioner/chef_zero.rb b/plugins/provisioners/chef/provisioner/chef_zero.rb index 70fff6854..43bdf648e 100644 --- a/plugins/provisioners/chef/provisioner/chef_zero.rb +++ b/plugins/provisioners/chef/provisioner/chef_zero.rb @@ -35,6 +35,7 @@ module VagrantPlugins upload_encrypted_data_bag_secret setup_json setup_zero_config + verify_chef_nodes_folder run_chef_zero delete_encrypted_data_bag_secret end @@ -101,6 +102,12 @@ module VagrantPlugins end end + def verify_chef_nodes_folder + if not File.exists? @config.nodes_path[0][1] + raise ChefError, :missing_chef_node_folder + end + end + protected # Extracts only the remote paths from a list of folders diff --git a/templates/locales/en.yml b/templates/locales/en.yml index deae43256..a05c267c2 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -2192,6 +2192,8 @@ en: running_solo_again: "Running chef-solo again (failed to converge)..." running_zero: "Running chef-client (local-mode)..." running_zero_again: "Running chef-client (local-mode) again (failed to converge)..." + missing_chef_node_folder: |- + Nodes folder that Chef requires is missing in this Vagrant project missing_shared_folders: |- Shared folders that Chef requires are missing on the virtual machine. This is usually due to configuration changing after already booting the