Prefix tempfiles with vagrant-

This commit is contained in:
Seth Vargo 2016-05-31 00:18:16 -04:00
parent 97f5ace2f2
commit 49ce775b53
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
18 changed files with 20 additions and 20 deletions

View File

@ -25,7 +25,7 @@ module VagrantPlugins
remote_path = "/tmp/vagrant-network-#{Time.now.to_i}-#{i}" remote_path = "/tmp/vagrant-network-#{Time.now.to_i}-#{i}"
Tempfile.open("arch-configure-networks") do |f| Tempfile.open("vagrant-arch-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -54,7 +54,7 @@ module VagrantPlugins
}) })
end end
Tempfile.open("coreos-configure-networks") do |f| Tempfile.open("vagrant-coreos-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -31,7 +31,7 @@ module VagrantPlugins
# Perform the careful dance necessary to reconfigure the network # Perform the careful dance necessary to reconfigure the network
# interfaces. # interfaces.
Tempfile.open("debian-configure-networks") do |f| Tempfile.open("vagrant-debian-configure-networks") do |f|
f.binmode f.binmode
f.write(entries.join("\n")) f.write(entries.join("\n"))
f.fsync f.fsync

View File

@ -96,7 +96,7 @@ module VagrantPlugins
entry = TemplateRenderer.render("guests/fedora/network_#{network[:type]}", entry = TemplateRenderer.render("guests/fedora/network_#{network[:type]}",
options: network) options: network)
Tempfile.open("fedora-configure-networks") do |f| Tempfile.open("vagrant-fedora-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -29,7 +29,7 @@ module VagrantPlugins
entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}", entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}",
options: network, ifname: ifname) options: network, ifname: ifname)
Tempfile.open("freebsd-configure-networks") do |f| Tempfile.open("vagrant-freebsd-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -25,7 +25,7 @@ module VagrantPlugins
options: network) options: network)
# Upload the entry to a temporary location # Upload the entry to a temporary location
Tempfile.open("funtoo-configure-networks") do |f| Tempfile.open("vagrant-funtoo-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -21,7 +21,7 @@ module VagrantPlugins
options: network) options: network)
# Upload the entry to a temporary location # Upload the entry to a temporary location
Tempfile.open("gentoo-configure-networks") do |f| Tempfile.open("vagrant-gentoo-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -20,7 +20,7 @@ module VagrantPlugins
entry = TemplateRenderer.render("guests/netbsd/network_#{network[:type]}", entry = TemplateRenderer.render("guests/netbsd/network_#{network[:type]}",
options: network) options: network)
Tempfile.open("netbsd-configure-networks") do |f| Tempfile.open("vagrant-netbsd-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -18,7 +18,7 @@ module VagrantPlugins
def self.upload(machine, content, remote_path) def self.upload(machine, content, remote_path)
remote_temp = mktemp(machine) remote_temp = mktemp(machine)
Tempfile.open("nixos-change-host-name") do |f| Tempfile.open("vagrant-nixos-change-host-name") do |f|
f.binmode f.binmode
f.write(content) f.write(content)
f.fsync f.fsync

View File

@ -67,7 +67,7 @@ module VagrantPlugins
def self.upload(machine, content, remote_path) def self.upload(machine, content, remote_path)
remote_temp = mktemp(machine) remote_temp = mktemp(machine)
Tempfile.open("nixos-configure-networks") do |f| Tempfile.open("vagrant-nixos-configure-networks") do |f|
f.binmode f.binmode
f.write(content) f.write(content)
f.fsync f.fsync

View File

@ -13,7 +13,7 @@ module VagrantPlugins
entry = TemplateRenderer.render("guests/openbsd/network_#{network[:type]}", entry = TemplateRenderer.render("guests/openbsd/network_#{network[:type]}",
options: network) options: network)
Tempfile.open("openbsd-configure-networks") do |f| Tempfile.open("vagrant-openbsd-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -55,7 +55,7 @@ module VagrantPlugins
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}", entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
options: network) options: network)
Tempfile.open("red-hat-configure-networks") do |f| Tempfile.open("vagrant-red-hat-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -20,7 +20,7 @@ module VagrantPlugins
entry = TemplateRenderer.render("guests/slackware/network_#{network[:type]}", options: network) entry = TemplateRenderer.render("guests/slackware/network_#{network[:type]}", options: network)
Tempfile.open("slackware-configure-networks") do |f| Tempfile.open("vagrant-slackware-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -33,7 +33,7 @@ module VagrantPlugins
entry = TemplateRenderer.render("guests/suse/network_#{network[:type]}", entry = TemplateRenderer.render("guests/suse/network_#{network[:type]}",
options: network) options: network)
Tempfile.open("suse-configure-networks") do |f| Tempfile.open("vagrant-suse-configure-networks") do |f|
f.binmode f.binmode
f.write(entry) f.write(entry)
f.fsync f.fsync

View File

@ -107,7 +107,7 @@ module VagrantPlugins
create_and_chown_remote_folder(inventory_basedir) create_and_chown_remote_folder(inventory_basedir)
@machine.communicate.sudo("rm -f #{inventory_path}", error_check: false) @machine.communicate.sudo("rm -f #{inventory_path}", error_check: false)
Tempfile.open("ansible-local-inventory-#{@machine.name}") do |f| Tempfile.open("vagrant-ansible-local-inventory-#{@machine.name}") do |f|
f.binmode f.binmode
f.write(inventory_content) f.write(inventory_content)
f.fsync f.fsync

View File

@ -142,7 +142,7 @@ module VagrantPlugins
# Create a temporary file to store the data so we can upload it. # Create a temporary file to store the data so we can upload it.
remote_file = File.join(guest_provisioning_path, filename) remote_file = File.join(guest_provisioning_path, filename)
@machine.communicate.sudo(remove_command(remote_file), error_check: false) @machine.communicate.sudo(remove_command(remote_file), error_check: false)
Tempfile.open("chef-provisioner-config") do |f| Tempfile.open("vagrant-chef-provisioner-config") do |f|
f.binmode f.binmode
f.write(config_file) f.write(config_file)
f.fsync f.fsync
@ -163,7 +163,7 @@ module VagrantPlugins
# Create a temporary file to store the data so we can upload it. # Create a temporary file to store the data so we can upload it.
remote_file = File.join(guest_provisioning_path, "dna.json") remote_file = File.join(guest_provisioning_path, "dna.json")
@machine.communicate.sudo(remove_command(remote_file), error_check: false) @machine.communicate.sudo(remove_command(remote_file), error_check: false)
Tempfile.open("chef-provisioner-config") do |f| Tempfile.open("vagrant-chef-provisioner-config") do |f|
f.binmode f.binmode
f.write(json) f.write(json)
f.fsync f.fsync

View File

@ -55,7 +55,7 @@ module VagrantPlugins
# machine. # machine.
def upload_recipe def upload_recipe
# Write the raw recipe contents to a tempfile and upload # Write the raw recipe contents to a tempfile and upload
Tempfile.open(["chef-apply", ".rb"]) do |f| Tempfile.open(["vagrant-chef-apply", ".rb"]) do |f|
f.binmode f.binmode
f.write(config.recipe) f.write(config.recipe)
f.fsync f.fsync

View File

@ -39,7 +39,7 @@ describe Vagrant::BoxCollection, :skip_windows do
end end
it 'does not raise an exception when a file appears in the boxes dir' do it 'does not raise an exception when a file appears in the boxes dir' do
Tempfile.open('a_file', environment.boxes_dir) do Tempfile.open('vagrant-a_file', environment.boxes_dir) do
expect { subject.all }.to_not raise_error expect { subject.all }.to_not raise_error
end end
end end
@ -344,7 +344,7 @@ describe Vagrant::BoxCollection, :skip_windows do
CHECKSUM_OFFSET = 148 CHECKSUM_OFFSET = 148
CHECKSUM_LENGTH = 8 CHECKSUM_LENGTH = 8
Tempfile.open(['vagrant_testing', '.tar']) do |f| Tempfile.open(['vagrant-testing', '.tar']) do |f|
f.binmode f.binmode
# Corrupt the tar by writing over the checksum field # Corrupt the tar by writing over the checksum field