From 068b5cf0b904867e739fe554ae9083ef0c128c6a Mon Sep 17 00:00:00 2001 From: Shawn Neal Date: Tue, 29 Apr 2014 12:58:47 -0700 Subject: [PATCH] Move Windows symlink re-establishment after reboot into capability This reduces the complexity and likelihood of provisioner bugs. --- plugins/guests/windows/cap/reboot.rb | 4 ++++ plugins/provisioners/chef/provisioner/chef_client.rb | 8 -------- plugins/provisioners/chef/provisioner/chef_solo.rb | 8 -------- plugins/provisioners/puppet/provisioner/puppet.rb | 8 -------- 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/plugins/guests/windows/cap/reboot.rb b/plugins/guests/windows/cap/reboot.rb index e09037cf2..2534a1e2b 100644 --- a/plugins/guests/windows/cap/reboot.rb +++ b/plugins/guests/windows/cap/reboot.rb @@ -12,6 +12,10 @@ module VagrantPlugins while machine.communicate.execute(script, error_check: false) != 0 sleep 10 end + + # This re-establishes our symbolic links if they were + # created between now and a reboot + machine.communicate.execute("net use", error_check: false) end end end diff --git a/plugins/provisioners/chef/provisioner/chef_client.rb b/plugins/provisioners/chef/provisioner/chef_client.rb index 935cec6bf..f475b1a82 100644 --- a/plugins/provisioners/chef/provisioner/chef_client.rb +++ b/plugins/provisioners/chef/provisioner/chef_client.rb @@ -62,14 +62,6 @@ module VagrantPlugins @machine.guest.capability(:wait_for_reboot) end - if windows? - # This re-establishes our symbolic links if they were - # created between now and a reboot - @machine.communicate.execute( - "& net use a-non-existant-share", - error_check: false) - end - command = build_command(:client) @config.attempts.times do |attempt| diff --git a/plugins/provisioners/chef/provisioner/chef_solo.rb b/plugins/provisioners/chef/provisioner/chef_solo.rb index db926e11c..53a2af0d3 100644 --- a/plugins/provisioners/chef/provisioner/chef_solo.rb +++ b/plugins/provisioners/chef/provisioner/chef_solo.rb @@ -138,14 +138,6 @@ module VagrantPlugins @machine.guest.capability(:wait_for_reboot) end - if windows? - # This re-establishes our symbolic links if they were - # created between now and a reboot - @machine.communicate.execute( - "& net use a-non-existant-share", - error_check: false) - end - command = build_command(:solo) @config.attempts.times do |attempt| diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index 93dfc50f9..7398026d4 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -101,14 +101,6 @@ module VagrantPlugins end def run_puppet_apply - if windows? - # This re-establishes our symbolic links if they were - # created between now and a reboot - @machine.communicate.execute( - "& net use a-non-existant-share", - error_check: false) - end - default_module_path = "/etc/puppet/modules" if windows? default_module_path = "/ProgramData/PuppetLabs/puppet/etc/modules"