provisioner/shell: proper extension on temporary file
This commit is contained in:
parent
89671974cf
commit
bddc7928ad
|
@ -116,6 +116,7 @@ module VagrantPlugins
|
||||||
# on the remote server. This method will properly clean up the
|
# on the remote server. This method will properly clean up the
|
||||||
# script file if needed.
|
# script file if needed.
|
||||||
def with_script_file
|
def with_script_file
|
||||||
|
ext = nil
|
||||||
script = nil
|
script = nil
|
||||||
|
|
||||||
if config.remote?
|
if config.remote?
|
||||||
|
@ -125,6 +126,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Vagrant::Util::Downloader.new(config.path, download_path).download!
|
Vagrant::Util::Downloader.new(config.path, download_path).download!
|
||||||
|
ext = File.extname(config.path)
|
||||||
script = download_path.read
|
script = download_path.read
|
||||||
ensure
|
ensure
|
||||||
download_path.delete if download_path.file?
|
download_path.delete if download_path.file?
|
||||||
|
@ -134,9 +136,11 @@ module VagrantPlugins
|
||||||
elsif config.path
|
elsif config.path
|
||||||
# Just yield the path to that file...
|
# Just yield the path to that file...
|
||||||
root_path = @machine.env.root_path
|
root_path = @machine.env.root_path
|
||||||
|
ext = File.extname(config.path)
|
||||||
script = Pathname.new(config.path).expand_path(root_path).read
|
script = Pathname.new(config.path).expand_path(root_path).read
|
||||||
else
|
else
|
||||||
# The script is just the inline code...
|
# The script is just the inline code...
|
||||||
|
ext = ".ps1"
|
||||||
script = config.inline
|
script = config.inline
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -148,7 +152,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
# Otherwise we have an inline script, we need to Tempfile it,
|
# Otherwise we have an inline script, we need to Tempfile it,
|
||||||
# and handle it specially...
|
# and handle it specially...
|
||||||
file = Tempfile.new('vagrant-shell')
|
file = Tempfile.new(['vagrant-shell', ext])
|
||||||
|
|
||||||
# Unless you set binmode, on a Windows host the shell script will
|
# Unless you set binmode, on a Windows host the shell script will
|
||||||
# have CRLF line endings instead of LF line endings, causing havoc
|
# have CRLF line endings instead of LF line endings, causing havoc
|
||||||
|
|
Loading…
Reference in New Issue