From 2be01284eae4cdbcd5957fcc96148a3c7d43b929 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 14 Oct 2013 17:12:49 -1000 Subject: [PATCH] provisioners/chef: fix exception during node cleanup [GH-2345] --- CHANGELOG.md | 2 ++ plugins/provisioners/chef/provisioner/chef_client.rb | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a9cc1b28..a7219f5fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ BUG FIXES: - providers/virtualbox: Retryable VBoxManage commands are properly retried. [GH-2365] - provisioners/ansible: Verbosity won't be blank by default. [GH-2320] + - provisioners/chef: Fix exception raised during Chef client node + cleanup. [GH-2345] - provisioners/salt: Correct master seed file name. [GH-2359] ## 1.3.4 (October 2, 2013) diff --git a/plugins/provisioners/chef/provisioner/chef_client.rb b/plugins/provisioners/chef/provisioner/chef_client.rb index 93a208a28..d5d259060 100644 --- a/plugins/provisioners/chef/provisioner/chef_client.rb +++ b/plugins/provisioners/chef/provisioner/chef_client.rb @@ -27,8 +27,8 @@ module VagrantPlugins end def cleanup - delete_from_chef_server('client') if config.delete_client - delete_from_chef_server('node') if config.delete_node + delete_from_chef_server('client') if @config.delete_client + delete_from_chef_server('node') if @config.delete_node end def create_client_key_folder @@ -105,16 +105,15 @@ module VagrantPlugins end def delete_from_chef_server(deletable) - env = @machine.env - node_name = config.node_name || env[:vm].config.vm.host_name - env[:ui].info(I18n.t( + node_name = @config.node_name || @machine.config.vm.host_name + @machine.env.ui.info(I18n.t( "vagrant.provisioners.chef.deleting_from_server", deletable: deletable, name: node_name)) command = ["knife", deletable, "delete", "--yes", node_name] r = Vagrant::Util::Subprocess.execute(*command) if r.exit_code != 0 - env[:ui].error(I18n.t( + @machine.env.ui.error(I18n.t( "vagrant.chef_client_cleanup_failed", deletable: deletable, stdout: r.stdout,