From 1ac3fb39fc141af4e0ba83aff5906a9937759cde Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 29 Aug 2013 11:36:37 -0700 Subject: [PATCH] provisioners/chef: error if knife not found and auto-deleting --- plugins/provisioners/chef/config/chef_client.rb | 8 ++++++++ templates/locales/en.yml | 3 +++ 2 files changed, 11 insertions(+) diff --git a/plugins/provisioners/chef/config/chef_client.rb b/plugins/provisioners/chef/config/chef_client.rb index 798a716f7..20fc4c17a 100644 --- a/plugins/provisioners/chef/config/chef_client.rb +++ b/plugins/provisioners/chef/config/chef_client.rb @@ -1,5 +1,7 @@ require File.expand_path("../base", __FILE__) +require "vagrant/util/which" + module VagrantPlugins module Chef module Config @@ -50,6 +52,12 @@ module VagrantPlugins errors << I18n.t("vagrant.config.chef.validation_key_path") if \ !validation_key_path + if delete_client || delete_node + if !Vagrant::Util::Which.which("knife") + errors << I18n.t("vagrant.chef_config_knife_not_found") + end + end + { "chef client provisioner" => errors } end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index b00792ae6..fa2b7093a 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -33,6 +33,9 @@ en: stdout: %{stdout} stderr: %{stderr} + chef_config_knife_not_found: |- + The `knife` application was not found! This is required by Vagrant + to automatically delete Chef nodes and clients. chef_run_list_empty: |- Warning: Chef solo run list is empty. This may not be what you want. provisioner_cleanup: |-