From 2a190a299e5ffa8c544924b8586ea00d39744800 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Mon, 17 Jun 2013 22:36:21 -0700 Subject: [PATCH] Cleanup tempfiles when done. --- lib/vagrant-hostmanager/hosts_file.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vagrant-hostmanager/hosts_file.rb b/lib/vagrant-hostmanager/hosts_file.rb index 4f81fed..395b3e8 100644 --- a/lib/vagrant-hostmanager/hosts_file.rb +++ b/lib/vagrant-hostmanager/hosts_file.rb @@ -26,6 +26,7 @@ module VagrantPlugins end env.machine(name,p).communicate.upload(path.join("hosts.#{name}"), '/tmp/hosts') env.machine(name,p).communicate.sudo("mv /tmp/hosts /etc/hosts") + FileUtils.rm(path.join("hosts.#{name}")) end end @@ -53,6 +54,7 @@ module VagrantPlugins machine.communicate.upload(path.join("hosts.#{name}"), '/tmp/hosts') machine.communicate.sudo("mv /tmp/hosts /etc/hosts") end + FileUtils.rm(path.join("hosts.#{name}")) end end end @@ -95,6 +97,7 @@ module VagrantPlugins @logger.warn "Running sudo to replace local hosts file, enter your local password if prompted..." @logger.info `sudo cp -v #{temp_file_name} #{file_name}` end + FileUtils.rm(temp_file_name) end def delete_entry(machine,file_name,sudo=false) @@ -117,6 +120,7 @@ module VagrantPlugins machine.env.ui.info I18n.t('vagrant_hostmanager.action.run_sudo') @logger.info `sudo cp -v #{temp_file_name} #{file_name}` end + FileUtils.rm(temp_file_name) else @logger.warn "Machine id to delete was empty, skipping..." end