From 40eb97893152e8a618f31b1f8e60302a1364162d Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Tue, 20 Jan 2015 14:28:29 +0100 Subject: [PATCH 01/30] fix checksum verification for downloaded boxes (fixes #4665) This makes sure that config.vm.box_download_checksum and config.vm.box_download_checksum_type get passed to Vagrant::Action.action_box_add with other options on box download/import. --- lib/vagrant/action/builtin/handle_box.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vagrant/action/builtin/handle_box.rb b/lib/vagrant/action/builtin/handle_box.rb index a01e49d64..8cbdd413c 100644 --- a/lib/vagrant/action/builtin/handle_box.rb +++ b/lib/vagrant/action/builtin/handle_box.rb @@ -64,6 +64,8 @@ module Vagrant box_download_ca_path = machine.config.vm.box_download_ca_path box_download_client_cert = machine.config.vm.box_download_client_cert box_download_insecure = machine.config.vm.box_download_insecure + box_download_checksum_type = machine.config.vm.box_download_checksum_type + box_download_checksum = machine.config.vm.box_download_checksum box_formats = machine.provider_options[:box_format] || machine.provider_name @@ -86,6 +88,8 @@ module Vagrant box_download_ca_cert: box_download_ca_cert, box_download_ca_path: box_download_ca_path, box_download_insecure: box_download_insecure, + box_checksum_type: box_download_checksum_type, + box_checksum: box_download_checksum, })) rescue Errors::BoxAlreadyExists # Just ignore this, since it means the next part will succeed! From 31163da0d544585f741b143e7dd8697677c6f091 Mon Sep 17 00:00:00 2001 From: Shawn Neal Date: Tue, 20 Jan 2015 11:45:57 -0800 Subject: [PATCH 02/30] Use winrm-fs for file uploads Replace the Vagrant native winrm file upload functionality with the winrm-fs gem. --- plugins/communicators/winrm/file_manager.rb | 163 -------------------- plugins/communicators/winrm/shell.rb | 8 +- vagrant.gemspec | 3 +- 3 files changed, 7 insertions(+), 167 deletions(-) delete mode 100644 plugins/communicators/winrm/file_manager.rb diff --git a/plugins/communicators/winrm/file_manager.rb b/plugins/communicators/winrm/file_manager.rb deleted file mode 100644 index 71586b811..000000000 --- a/plugins/communicators/winrm/file_manager.rb +++ /dev/null @@ -1,163 +0,0 @@ -require "log4r" - -module VagrantPlugins - module CommunicatorWinRM - # Manages the file system on the remote guest allowing for file tranfer - # between the guest and host. - class FileManager - def initialize(shell) - @logger = Log4r::Logger.new("vagrant::communication::filemanager") - @shell = shell - end - - # Uploads the given file or directory from the host to the guest (recursively). - # - # @param [String] The source file or directory path on the host - # @param [String] The destination file or directory path on the host - def upload(host_src_file_path, guest_dest_file_path) - @logger.debug("Upload: #{host_src_file_path} -> #{guest_dest_file_path}") - if File.directory?(host_src_file_path) - upload_directory(host_src_file_path, guest_dest_file_path) - else - upload_file(host_src_file_path, guest_dest_file_path) - end - end - - # Downloads the given file from the guest to the host. - # NOTE: This currently only supports single file download - # - # @param [String] The source file path on the guest - # @param [String] The destination file path on the host - def download(guest_src_file_path, host_dest_file_path) - @logger.debug("#{guest_src_file_path} -> #{host_dest_file_path}") - - output = @shell.powershell("[System.convert]::ToBase64String([System.IO.File]::ReadAllBytes(\"#{guest_src_file_path}\"))") - contents = output[:data].map!{|line| line[:stdout]}.join.gsub("\\n\\r", '') - out = Base64.decode64(contents) - IO.binwrite(host_dest_file_path, out) - end - - private - - # Recursively uploads the given directory from the host to the guest - # - # @param [String] The source file or directory path on the host - # @param [String] The destination file or directory path on the host - def upload_directory(host_src_file_path, guest_dest_file_path) - glob_patt = File.join(host_src_file_path, '**/*') - Dir.glob(glob_patt).select { |f| !File.directory?(f) }.each do |host_file_path| - guest_file_path = guest_file_path(host_src_file_path, guest_dest_file_path, host_file_path) - upload_file(host_file_path, guest_file_path) - end - end - - # Uploads the given file, but only if the target file doesn't exist - # or its MD5 checksum doens't match the host's source checksum. - # - # @param [String] The source file path on the host - # @param [String] The destination file path on the guest - def upload_file(host_src_file_path, guest_dest_file_path) - if should_upload_file?(host_src_file_path, guest_dest_file_path) - tmp_file_path = upload_to_temp_file(host_src_file_path) - decode_temp_file(tmp_file_path, guest_dest_file_path) - else - @logger.debug("Up to date: #{guest_dest_file_path}") - end - end - - # Uploads the given file to a new temp file on the guest - # - # @param [String] The source file path on the host - # @return [String] The temp file path on the guest - def upload_to_temp_file(host_src_file_path) - tmp_file_path = File.join(guest_temp_dir, "winrm-upload-#{rand()}") - @logger.debug("Uploading '#{host_src_file_path}' to temp file '#{tmp_file_path}'") - - base64_host_file = Base64.encode64(IO.binread(host_src_file_path)).gsub("\n",'') - base64_host_file.chars.to_a.each_slice(8000-tmp_file_path.size) do |chunk| - out = @shell.cmd("echo #{chunk.join} >> \"#{tmp_file_path}\"") - raise_upload_error_if_failed(out, host_src_file_path, tmp_file_path) - end - - tmp_file_path - end - - # Moves and decodes the given file temp file on the guest to its - # permanent location - # - # @param [String] The source base64 encoded temp file path on the guest - # @param [String] The destination file path on the guest - def decode_temp_file(guest_tmp_file_path, guest_dest_file_path) - @logger.debug("Decoding temp file '#{guest_tmp_file_path}' to '#{guest_dest_file_path}'") - out = @shell.powershell <<-EOH - $tmp_file_path = [System.IO.Path]::GetFullPath('#{guest_tmp_file_path}') - $dest_file_path = [System.IO.Path]::GetFullPath('#{guest_dest_file_path}') - - if (Test-Path $dest_file_path) { - rm $dest_file_path - } - else { - $dest_dir = ([System.IO.Path]::GetDirectoryName($dest_file_path)) - New-Item -ItemType directory -Force -Path $dest_dir - } - - $base64_string = Get-Content $tmp_file_path - $bytes = [System.Convert]::FromBase64String($base64_string) - [System.IO.File]::WriteAllBytes($dest_file_path, $bytes) - EOH - raise_upload_error_if_failed(out, guest_tmp_file_path, guest_dest_file_path) - end - - # Checks to see if the target file on the guest is missing or out of date. - # - # @param [String] The source file path on the host - # @param [String] The destination file path on the guest - # @return [Boolean] True if the file is missing or out of date - def should_upload_file?(host_src_file_path, guest_dest_file_path) - local_md5 = Digest::MD5.file(host_src_file_path).hexdigest - cmd = <<-EOH - $dest_file_path = [System.IO.Path]::GetFullPath('#{guest_dest_file_path}') - - if (Test-Path $dest_file_path) { - $crypto_provider = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider - try { - $file = [System.IO.File]::Open($dest_file_path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read) - $guest_md5 = ([System.BitConverter]::ToString($crypto_provider.ComputeHash($file))).Replace("-","").ToLower() - } - finally { - $file.Dispose() - } - if ($guest_md5 -eq '#{local_md5}') { - exit 0 - } - } - Write-Host "should upload file $dest_file_path" - exit 1 - EOH - @shell.powershell(cmd)[:exitcode] == 1 - end - - # Creates a guest file path equivalent from a host file path - # - # @param [String] The base host directory we're going to copy from - # @param [String] The base guest directory we're going to copy to - # @param [String] A full path to a file on the host underneath host_base_dir - # @return [String] The guest file path equivalent - def guest_file_path(host_base_dir, guest_base_dir, host_file_path) - rel_path = File.dirname(host_file_path[host_base_dir.length, host_file_path.length]) - File.join(guest_base_dir, rel_path, File.basename(host_file_path)) - end - - def guest_temp_dir - @guest_temp ||= (@shell.cmd('echo %TEMP%'))[:data][0][:stdout].chomp - end - - def raise_upload_error_if_failed(out, from, to) - raise Errors::WinRMFileTransferError, - from: from, - to: to, - message: out.inspect if out[:exitcode] != 0 - end - end - end -end diff --git a/plugins/communicators/winrm/shell.rb b/plugins/communicators/winrm/shell.rb index 2a116ec30..4b9542185 100644 --- a/plugins/communicators/winrm/shell.rb +++ b/plugins/communicators/winrm/shell.rb @@ -9,7 +9,7 @@ Vagrant::Util::SilenceWarnings.silence! do require "winrm" end -require_relative "file_manager" +require "winrm-fs/file_manager" module VagrantPlugins module CommunicatorWinRM @@ -67,11 +67,13 @@ module VagrantPlugins end def upload(from, to) - FileManager.new(self).upload(from, to) + file_manager = WinRM::FS::FileManager.new(session) + file_manager.upload(from, to) end def download(from, to) - FileManager.new(self).download(from, to) + file_manager = WinRM::FS::FileManager.new(session) + file_manager.download(from, to) end protected diff --git a/vagrant.gemspec b/vagrant.gemspec index d2b939852..8fa73e7ea 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -28,7 +28,8 @@ Gem::Specification.new do |s| s.add_dependency "rb-kqueue", "~> 0.2.0" s.add_dependency "rest-client", ">= 1.6.0", "< 2.0" s.add_dependency "wdm", "~> 0.1.0" - s.add_dependency "winrm", "~> 1.1.3" + s.add_dependency "winrm", "~> 1.3.0" + s.add_dependency "winrm-fs", "~> 0.1.0" # We lock this down to avoid compilation issues. s.add_dependency "nokogiri", "= 1.6.3.1" From 58435b7dcac817ff6d93a76d0ab875a434f4d5dd Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 21 Jan 2015 16:22:10 +0100 Subject: [PATCH 03/30] Add a note to the "external script" section how to run existing scripts Closes-bug: #5228 --- website/docs/source/v2/provisioning/shell.html.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/website/docs/source/v2/provisioning/shell.html.md b/website/docs/source/v2/provisioning/shell.html.md index ffc9580c7..574289353 100644 --- a/website/docs/source/v2/provisioning/shell.html.md +++ b/website/docs/source/v2/provisioning/shell.html.md @@ -136,6 +136,15 @@ that the external path has the proper extension (".bat" or ".ps1"), because Windows uses this to determine what kind fo file it is to execute. If you exclude this extension, it likely won't work. +To run a script already available on the guest you have to use an inline script. + +```ruby +Vagrant.configure("2") do |config| + config.vm.provision "shell", + inline: "/path/to/the/script/on/the/guest" +end +``` + ## Script Arguments You can parameterize your scripts as well like any normal shell script. From ce4525e7fd301f70d6008de9971b4c5f62b75824 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 21 Jan 2015 10:26:27 -0500 Subject: [PATCH 04/30] Clean up words a bit --- website/docs/source/v2/provisioning/shell.html.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/docs/source/v2/provisioning/shell.html.md b/website/docs/source/v2/provisioning/shell.html.md index 574289353..e46d0ad52 100644 --- a/website/docs/source/v2/provisioning/shell.html.md +++ b/website/docs/source/v2/provisioning/shell.html.md @@ -136,12 +136,13 @@ that the external path has the proper extension (".bat" or ".ps1"), because Windows uses this to determine what kind fo file it is to execute. If you exclude this extension, it likely won't work. -To run a script already available on the guest you have to use an inline script. +To run a script already available on the guest you can use an inline script to +invoke the remote script on the guest. ```ruby Vagrant.configure("2") do |config| config.vm.provision "shell", - inline: "/path/to/the/script/on/the/guest" + inline: "/bin/sh /path/to/the/script/already/on/the/guest.sh" end ``` From 88ab9f740298104862ef6c6e408109d91ba8baa0 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 21 Jan 2015 10:51:39 -0800 Subject: [PATCH 05/30] providers/virtualbox: read netmask from dhcpservers This should fix the cleaning up of the default VirtualBox dhcpserver, which we've been fighting with for ages over in #3083. We were checking for a structure _including_ a netmask, but the driver was not populating netmask. --- plugins/providers/virtualbox/driver/version_4_0.rb | 2 ++ plugins/providers/virtualbox/driver/version_4_1.rb | 2 ++ plugins/providers/virtualbox/driver/version_4_2.rb | 2 ++ plugins/providers/virtualbox/driver/version_4_3.rb | 2 ++ .../support/shared/virtualbox_driver_version_4_x_examples.rb | 5 +++-- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/providers/virtualbox/driver/version_4_0.rb b/plugins/providers/virtualbox/driver/version_4_0.rb index a29193842..53361bbbb 100644 --- a/plugins/providers/virtualbox/driver/version_4_0.rb +++ b/plugins/providers/virtualbox/driver/version_4_0.rb @@ -265,6 +265,8 @@ module VagrantPlugins info[:network_name] = "HostInterfaceNetworking-#{network}" elsif ip = line[/^IP:\s+(.+?)$/, 1] info[:ip] = ip + elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1] + info[:netmask] = netmask elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1] info[:lower] = lower elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1] diff --git a/plugins/providers/virtualbox/driver/version_4_1.rb b/plugins/providers/virtualbox/driver/version_4_1.rb index c22042b6b..ae1830019 100644 --- a/plugins/providers/virtualbox/driver/version_4_1.rb +++ b/plugins/providers/virtualbox/driver/version_4_1.rb @@ -270,6 +270,8 @@ module VagrantPlugins info[:network_name] = "HostInterfaceNetworking-#{network}" elsif ip = line[/^IP:\s+(.+?)$/, 1] info[:ip] = ip + elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1] + info[:netmask] = netmask elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1] info[:lower] = lower elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1] diff --git a/plugins/providers/virtualbox/driver/version_4_2.rb b/plugins/providers/virtualbox/driver/version_4_2.rb index d976d973c..dc7da430a 100644 --- a/plugins/providers/virtualbox/driver/version_4_2.rb +++ b/plugins/providers/virtualbox/driver/version_4_2.rb @@ -293,6 +293,8 @@ module VagrantPlugins info[:network_name] = "HostInterfaceNetworking-#{network}" elsif ip = line[/^IP:\s+(.+?)$/, 1] info[:ip] = ip + elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1] + info[:netmask] = netmask elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1] info[:lower] = lower elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1] diff --git a/plugins/providers/virtualbox/driver/version_4_3.rb b/plugins/providers/virtualbox/driver/version_4_3.rb index 28e6539d4..2d257a8c1 100644 --- a/plugins/providers/virtualbox/driver/version_4_3.rb +++ b/plugins/providers/virtualbox/driver/version_4_3.rb @@ -302,6 +302,8 @@ module VagrantPlugins info[:network_name] = "HostInterfaceNetworking-#{network}" elsif ip = line[/^IP:\s+(.+?)$/, 1] info[:ip] = ip + elsif netmask = line[/^NetworkMask:\s+(.+?)$/, 1] + info[:netmask] = netmask elsif lower = line[/^lowerIPAddress:\s+(.+?)$/, 1] info[:lower] = lower elsif upper = line[/^upperIPAddress:\s+(.+?)$/, 1] diff --git a/test/unit/plugins/providers/virtualbox/support/shared/virtualbox_driver_version_4_x_examples.rb b/test/unit/plugins/providers/virtualbox/support/shared/virtualbox_driver_version_4_x_examples.rb index 513f065a7..88f199a82 100644 --- a/test/unit/plugins/providers/virtualbox/support/shared/virtualbox_driver_version_4_x_examples.rb +++ b/test/unit/plugins/providers/virtualbox/support/shared/virtualbox_driver_version_4_x_examples.rb @@ -37,6 +37,7 @@ shared_examples "a version 4.x virtualbox driver" do |options| network_name: 'HostInterfaceNetworking-vboxnet0', network: 'vboxnet0', ip: '172.28.128.2', + netmask: '255.255.255.0', lower: '172.28.128.3', upper: '172.28.128.254', }]) @@ -65,8 +66,8 @@ shared_examples "a version 4.x virtualbox driver" do |options| it "returns a list with one entry for each server" do expect(subject.read_dhcp_servers).to eq([ - {network_name: 'HostInterfaceNetworking-vboxnet0', network: 'vboxnet0', ip: '172.28.128.2', lower: '172.28.128.3', upper: '172.28.128.254'}, - {network_name: 'HostInterfaceNetworking-vboxnet1', network: 'vboxnet1', ip: '10.0.0.2', lower: '10.0.0.3', upper: '10.0.0.254'}, + {network_name: 'HostInterfaceNetworking-vboxnet0', network: 'vboxnet0', ip: '172.28.128.2', netmask: '255.255.255.0', lower: '172.28.128.3', upper: '172.28.128.254'}, + {network_name: 'HostInterfaceNetworking-vboxnet1', network: 'vboxnet1', ip: '10.0.0.2', netmask: '255.255.255.0', lower: '10.0.0.3', upper: '10.0.0.254'}, ]) end end From 1bc364febc936876117e1b22acac02d2ef4d687c Mon Sep 17 00:00:00 2001 From: Simon Vetter Date: Wed, 21 Jan 2015 21:40:25 +0100 Subject: [PATCH 06/30] add test for checksum options mapping --- .../vagrant/action/builtin/handle_box_test.rb | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/unit/vagrant/action/builtin/handle_box_test.rb b/test/unit/vagrant/action/builtin/handle_box_test.rb index 6b7d85818..17f32563f 100644 --- a/test/unit/vagrant/action/builtin/handle_box_test.rb +++ b/test/unit/vagrant/action/builtin/handle_box_test.rb @@ -106,4 +106,31 @@ describe Vagrant::Action::Builtin::HandleBox do subject.call(env) end end + + context "with a box with a checksum set" do + before do + machine.stub(box: nil) + + machine.config.vm.box = "foo" + machine.config.vm.box_url = "bar" + machine.config.vm.box_download_checksum_type = "sha256" + machine.config.vm.box_download_checksum = "1f42ac2decf0169c4af02b2d8c77143ce35f7ba87d5d844e19bf7cbb34fbe74e" + end + + it "adds a box that doesn't exist and maps checksum options correctly" do + expect(action_runner).to receive(:run).with { |action, opts| + expect(opts[:box_name]).to eq(machine.config.vm.box) + expect(opts[:box_url]).to eq(machine.config.vm.box_url) + expect(opts[:box_provider]).to eq(:dummy) + expect(opts[:box_version]).to eq(machine.config.vm.box_version) + expect(opts[:box_checksum_type]).to eq(machine.config.vm.box_download_checksum_type) + expect(opts[:box_checksum]).to eq(machine.config.vm.box_download_checksum) + true + } + + expect(app).to receive(:call).with(env) + + subject.call(env) + end + end end From 86d27528b350ac3915ac44f034f299dd1defa337 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 21 Jan 2015 16:05:51 -0500 Subject: [PATCH 07/30] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ecd67de9..073753654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ BUG FIXES: - core: push configurations are validated with global configs [GH-5130] - core: remove executable permissions on internal file [GH-5220] - core: check name and version in `has_plugin?` [GH-5218] + - core/cli: fix box checksum validation [GH-4665, GH-5221] - hosts/nfs: allow colons (`:`) in NFS IDs [GH-5222] - guests/funtoo: fix incorrect path in configure networks [GH-4812] - plugins/login: allow users to login with a token [GH-5145] From 96d1285b4f032e87362cd090a5d646afa8aca562 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 21 Jan 2015 16:55:28 -0500 Subject: [PATCH 08/30] Use 2014 for the license upgrade center URL --- website/www/source/vmware/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/www/source/vmware/index.html.erb b/website/www/source/vmware/index.html.erb index 9d1b8b8fb..26d738b07 100644 --- a/website/www/source/vmware/index.html.erb +++ b/website/www/source/vmware/index.html.erb @@ -177,7 +177,7 @@ page_title: "VMware Vagrant Environments" software, which must be purchased separately. If you're buying over 100 licenses, contact sales@hashicorp.com for volume pricing.
- Previous plugin versions may not support the latest VMware products. Please visit the license upgrade center to check if your license requires an upgrade before you upgrade your VMware products. + Previous plugin versions may not support the latest VMware products. Please visit the license upgrade center to check if your license requires an upgrade before you upgrade your VMware products.
For reseller information, click here. From daeaf25858287c5429cfbd557006b4bf9bb80a79 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 21 Jan 2015 17:01:44 -0500 Subject: [PATCH 09/30] Do no minify HTML on websites --- website/docs/config.rb | 7 ------- website/www/config.rb | 7 ------- 2 files changed, 14 deletions(-) diff --git a/website/docs/config.rb b/website/docs/config.rb index 40a858875..132037bb8 100644 --- a/website/docs/config.rb +++ b/website/docs/config.rb @@ -59,13 +59,6 @@ set :markdown, fenced_code_blocks: true configure :build do activate :asset_hash activate :minify_css - activate :minify_html do |html| - html.remove_quotes = false - html.remove_script_attributes = false - html.remove_multi_spaces = false - html.remove_http_protocol = false - html.remove_https_protocol = false - end activate :minify_javascript # Enable cache buster diff --git a/website/www/config.rb b/website/www/config.rb index d8ea935b6..d30b7bd51 100644 --- a/website/www/config.rb +++ b/website/www/config.rb @@ -33,12 +33,5 @@ end configure :build do activate :asset_hash activate :minify_css - activate :minify_html do |html| - html.remove_quotes = false - html.remove_script_attributes = false - html.remove_multi_spaces = false - html.remove_http_protocol = false - html.remove_https_protocol = false - end activate :minify_javascript end From d023408f78ec580f386e7d9b99f17ed7ed3d7027 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 21 Jan 2015 17:25:55 -0800 Subject: [PATCH 10/30] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 073753654..5a6f2acff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ BUG FIXES: - guests/funtoo: fix incorrect path in configure networks [GH-4812] - plugins/login: allow users to login with a token [GH-5145] - providers/hyperv: allow users to configure memory, cpu count, and vmname [GH-5183] + - providers/virtualbox: read netmask from dhcpservers [GH-5233] - provisioners/ansible: fix SSH settings to support more than 5 ssh keys [GH-5017] - provisioners/ansible: increase ansible connection timeout to 30 seconds [GH-5018] - provisioners/docker: use docker.com instead of docker.io [GH-5216] From 259568f68a45f87dc33d7713bd287ae7a6b73ae6 Mon Sep 17 00:00:00 2001 From: dragon788 Date: Thu, 22 Jan 2015 13:44:14 -0600 Subject: [PATCH 11/30] Clarified multiple additional options are possible Updated additional options section to clarify that multiple options can be specified, not just "a third" as originally suggested. --- website/docs/source/v2/synced-folders/basic_usage.html.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/docs/source/v2/synced-folders/basic_usage.html.md b/website/docs/source/v2/synced-folders/basic_usage.html.md index 5a1f7dcd5..841a34040 100644 --- a/website/docs/source/v2/synced-folders/basic_usage.html.md +++ b/website/docs/source/v2/synced-folders/basic_usage.html.md @@ -27,9 +27,10 @@ if it doesn't exist. ## Options -As an optional third parameter to configuring synced folders, you may specify -some options. These options are listed below. More detailed examples of using -some of these options are shown below this section. +You may also specify some additional parameters when configuring +synced folders. These options are listed below. More detailed examples of using +some of these options are shown below this section, note the owner/group example +supplies two additional options separated by commas. In addition to these options, the specific synced folder type might allow more options. See the documentation for your specific synced folder From f9a53a2c27dd951fe6610a5c1e9d7576af63b9a5 Mon Sep 17 00:00:00 2001 From: dragon788 Date: Thu, 22 Jan 2015 14:16:44 -0600 Subject: [PATCH 12/30] Clarified wording a little bit further --- website/docs/source/v2/synced-folders/basic_usage.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/source/v2/synced-folders/basic_usage.html.md b/website/docs/source/v2/synced-folders/basic_usage.html.md index 841a34040..dc8ee00aa 100644 --- a/website/docs/source/v2/synced-folders/basic_usage.html.md +++ b/website/docs/source/v2/synced-folders/basic_usage.html.md @@ -27,7 +27,7 @@ if it doesn't exist. ## Options -You may also specify some additional parameters when configuring +You may also specify additional optional parameters when configuring synced folders. These options are listed below. More detailed examples of using some of these options are shown below this section, note the owner/group example supplies two additional options separated by commas. From dfbcebef0ba82a14cef9791574bb5fa6e45b0919 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Sat, 24 Jan 2015 09:59:48 -0800 Subject: [PATCH 13/30] core: log action name to info I found this output to be very helpful in debugging an action hook problem in a plugin. problem. I'm not sure why the callable_id is useful (seem to always show up as an instance of `Builder` or `Warden` for me), but I left it in there just in case it's useful to someone. --- lib/vagrant/action/runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant/action/runner.rb b/lib/vagrant/action/runner.rb index bfb187709..8799a8d7f 100644 --- a/lib/vagrant/action/runner.rb +++ b/lib/vagrant/action/runner.rb @@ -62,7 +62,7 @@ module Vagrant end # We place a process lock around every action that is called - @logger.info("Running action: #{callable_id}") + @logger.info("Running action: #{environment[:action_name]} #{callable_id}") Util::Busy.busy(int_callback) { callable.call(environment) } # Return the environment in case there are things in there that From f2042c9cb32f9c7d6f7d93dbf3f27a7bf2a3587a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kr=C3=BCger?= Date: Wed, 28 Jan 2015 16:30:02 +0100 Subject: [PATCH 14/30] Document how to disable remote call to https://checkpoint-api.hashicorp.com . --- .../docs/source/v2/other/environmental-variables.html.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/website/docs/source/v2/other/environmental-variables.html.md b/website/docs/source/v2/other/environmental-variables.html.md index 9e0982cdc..c7099a6b7 100644 --- a/website/docs/source/v2/other/environmental-variables.html.md +++ b/website/docs/source/v2/other/environmental-variables.html.md @@ -9,6 +9,14 @@ Vagrant has a set of environmental variables that can be used to configure and control it in a global way. This page lists those environmental variables. +## VAGRANT\_CHECKPOINT\_DISABLE + +Vagrant does occasional network calls to check whether the version of Vagrant +that is running locally is up to date. We understand that software making remote +calls over the internet for any reason can be undesirable. To surpress these +calls, set the environment variable `VAGRANT_CHECKPOINT_DISABLE` to any +non-empty value. + ## VAGRANT\_CWD `VAGRANT_CWD` can be set to change the working directory of Vagrant. By From 0501cd5500c926aa68f25d55e0f96950c343faeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kr=C3=BCger?= Date: Thu, 29 Jan 2015 17:23:21 +0100 Subject: [PATCH 15/30] Adding a link to the environment variable documentation to the cli documentation. --- website/docs/source/v2/cli/index.html.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/docs/source/v2/cli/index.html.md b/website/docs/source/v2/cli/index.html.md index 7bc55a43e..345a902ab 100644 --- a/website/docs/source/v2/cli/index.html.md +++ b/website/docs/source/v2/cli/index.html.md @@ -22,3 +22,8 @@ accepts. In depth documentation and use cases of various Vagrant commands is available by reading the appropriate sub-section available in the left navigational area of this site. + +You may also wish to consult the +[documentation](/v2/other/environmental-variables.html) regarding the +environmental variables that can be used to configure and control +Vagrant in a global way. From fe312beef25739f9e9c7ac286122d416c6b2e1e1 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 2 Feb 2015 11:07:41 -0500 Subject: [PATCH 16/30] Do not encourage users to download a box directly Instead of having the user download a .box file and manually installing it, just use the hashicorp/precise64 box and let Vagrant handle the download. --- website/docs/source/v2/vmware/usage.html.md | 27 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/website/docs/source/v2/vmware/usage.html.md b/website/docs/source/v2/vmware/usage.html.md index 7dacce6bc..29ffa2180 100644 --- a/website/docs/source/v2/vmware/usage.html.md +++ b/website/docs/source/v2/vmware/usage.html.md @@ -15,10 +15,29 @@ Fusion, and `vmware_workstation` for VMware Workstation. The Vagrant VMware provider does not support parallel execution at this time. Specifying the `--parallel` option will have no effect. -

-To get started, a 64-bit Ubuntu 12.04 LTS VMware box is available at: -http://files.vagrantup.com/precise64_vmware.box -

+To get started, create a new `Vagrantfile` that points to a VMware box: + +```ruby +# vagrant init hashicorp/precise64 +Vagrant.configure(2) do |config| + config.vm.box = "hashicorp/precise64" +end +``` + +VMware Fusion users should then run: + +```shell +$ vagrant up --provider vmware_fusion +``` + +VMware Workstation users should then run: + +```shell +$ vagrant up --provider vmware_workstation +``` + +This will download and bring up a new VMware Fusion/Workstation virtual machine +in Vagrant.

From bec0f28f404c27413fe899c4d71c4b9bfeccfefb Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 2 Feb 2015 18:14:21 -0500 Subject: [PATCH 17/30] Use the new Atlas APIs for downloading boxes --- lib/vagrant/action/builtin/box_add.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant/action/builtin/box_add.rb b/lib/vagrant/action/builtin/box_add.rb index deed8b9ef..7dd09e0da 100644 --- a/lib/vagrant/action/builtin/box_add.rb +++ b/lib/vagrant/action/builtin/box_add.rb @@ -57,7 +57,7 @@ module Vagrant raise Errors::BoxServerNotSet if !server expanded = true - url[i] = "#{server}/#{url[i]}" + url[i] = "#{server}/api/v1/vagrant/#{url[i]}" end end From 6fd685e96df133ceed9f9f9fc40018a9880972e0 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 2 Feb 2015 19:17:37 -0500 Subject: [PATCH 18/30] Fix failing tests --- .../vagrant/action/builtin/box_add_test.rb | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test/unit/vagrant/action/builtin/box_add_test.rb b/test/unit/vagrant/action/builtin/box_add_test.rb index ad3a56dfc..82b476f5d 100644 --- a/test/unit/vagrant/action/builtin/box_add_test.rb +++ b/test/unit/vagrant/action/builtin/box_add_test.rb @@ -48,7 +48,7 @@ describe Vagrant::Action::Builtin::BoxAdd do AccessLog: [], Logger: WEBrick::Log.new(tf.path, 7), Port: port, - DocumentRoot: path.dirname.to_s, + DocumentRoot: path.to_s, MimeTypes: mime_types) thr = Thread.new { server.start } yield port @@ -308,7 +308,7 @@ describe Vagrant::Action::Builtin::BoxAdd do it "adds from shorthand path" do box_path = iso_env.box2_file(:virtualbox) td = Pathname.new(Dir.mktmpdir) - tf = td.join("mitchellh", "precise64.json") + tf = td.join("api", "v1", "vagrant", "mitchellh", "precise64.json") tf.dirname.mkpath tf.open("w") do |f| f.write(<<-RAW) @@ -332,7 +332,7 @@ describe Vagrant::Action::Builtin::BoxAdd do RAW end - with_web_server(tf.dirname) do |port| + with_web_server(td) do |port| url = "http://127.0.0.1:#{port}" env[:box_url] = "mitchellh/precise64.json" @@ -341,7 +341,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(version).to eq("0.7") expect(checksum(path)).to eq(checksum(box_path)) expect(opts[:metadata_url]).to eq( - "#{url}/#{env[:box_url]}") + "#{url}/api/v1/vagrant/#{env[:box_url]}") true }.and_return(box) @@ -356,7 +356,7 @@ describe Vagrant::Action::Builtin::BoxAdd do it "add from shorthand path with configured server url" do box_path = iso_env.box2_file(:virtualbox) td = Pathname.new(Dir.mktmpdir) - tf = td.join("mitchellh", "precise64.json") + tf = td.join("api", "v1", "vagrant", "mitchellh", "precise64.json") tf.dirname.mkpath tf.open("w") do |f| f.write(<<-RAW) @@ -380,7 +380,7 @@ describe Vagrant::Action::Builtin::BoxAdd do RAW end - with_web_server(tf.dirname) do |port| + with_web_server(td) do |port| url = "http://127.0.0.1:#{port}" env[:box_url] = "mitchellh/precise64.json" env[:box_server_url] = url @@ -390,7 +390,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(version).to eq("0.7") expect(checksum(path)).to eq(checksum(box_path)) expect(opts[:metadata_url]).to eq( - "#{url}/#{env[:box_url]}") + "#{url}/api/v1/vagrant/#{env[:box_url]}") true }.and_return(box) @@ -558,10 +558,11 @@ describe Vagrant::Action::Builtin::BoxAdd do end it "raises an error if shorthand is invalid" do - tf = Tempfile.new("foo") - tf.close + td = Pathname.new(Dir.mktmpdir) + tf = td.join("api", "v1", "vagrant", "foo") + tf.dirname.mkpath - with_web_server(Pathname.new(tf.path)) do |port| + with_web_server(td) do |port| env[:box_url] = "mitchellh/precise64.json" expect(box_collection).to receive(:add).never From bc7272b96da5ac0494140a4226e4b05d027440d5 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 2 Feb 2015 19:38:02 -0500 Subject: [PATCH 19/30] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a6f2acff..5240e2430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ BUG FIXES: - core: push configurations are validated with global configs [GH-5130] - core: remove executable permissions on internal file [GH-5220] - core: check name and version in `has_plugin?` [GH-5218] + - core: use new Atlas APIs for downloading boxes [GH-5274] - core/cli: fix box checksum validation [GH-4665, GH-5221] - hosts/nfs: allow colons (`:`) in NFS IDs [GH-5222] - guests/funtoo: fix incorrect path in configure networks [GH-4812] From a0be121f4fbe9f0b6bc8f2df57438dc80bd3467f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 3 Feb 2015 06:39:28 +0100 Subject: [PATCH 20/30] Revert "Merge pull request #5274 from mitchellh/sethvargo/atlas_api" This reverts commit 7f19284ef4e8a67ffbcac98aa30db89ccd370d99, reversing changes made to f0284d000be2480ae7a9d343bd54b6ef0d4d9e0a. --- lib/vagrant/action/builtin/box_add.rb | 2 +- .../vagrant/action/builtin/box_add_test.rb | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/vagrant/action/builtin/box_add.rb b/lib/vagrant/action/builtin/box_add.rb index 7dd09e0da..deed8b9ef 100644 --- a/lib/vagrant/action/builtin/box_add.rb +++ b/lib/vagrant/action/builtin/box_add.rb @@ -57,7 +57,7 @@ module Vagrant raise Errors::BoxServerNotSet if !server expanded = true - url[i] = "#{server}/api/v1/vagrant/#{url[i]}" + url[i] = "#{server}/#{url[i]}" end end diff --git a/test/unit/vagrant/action/builtin/box_add_test.rb b/test/unit/vagrant/action/builtin/box_add_test.rb index 82b476f5d..ad3a56dfc 100644 --- a/test/unit/vagrant/action/builtin/box_add_test.rb +++ b/test/unit/vagrant/action/builtin/box_add_test.rb @@ -48,7 +48,7 @@ describe Vagrant::Action::Builtin::BoxAdd do AccessLog: [], Logger: WEBrick::Log.new(tf.path, 7), Port: port, - DocumentRoot: path.to_s, + DocumentRoot: path.dirname.to_s, MimeTypes: mime_types) thr = Thread.new { server.start } yield port @@ -308,7 +308,7 @@ describe Vagrant::Action::Builtin::BoxAdd do it "adds from shorthand path" do box_path = iso_env.box2_file(:virtualbox) td = Pathname.new(Dir.mktmpdir) - tf = td.join("api", "v1", "vagrant", "mitchellh", "precise64.json") + tf = td.join("mitchellh", "precise64.json") tf.dirname.mkpath tf.open("w") do |f| f.write(<<-RAW) @@ -332,7 +332,7 @@ describe Vagrant::Action::Builtin::BoxAdd do RAW end - with_web_server(td) do |port| + with_web_server(tf.dirname) do |port| url = "http://127.0.0.1:#{port}" env[:box_url] = "mitchellh/precise64.json" @@ -341,7 +341,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(version).to eq("0.7") expect(checksum(path)).to eq(checksum(box_path)) expect(opts[:metadata_url]).to eq( - "#{url}/api/v1/vagrant/#{env[:box_url]}") + "#{url}/#{env[:box_url]}") true }.and_return(box) @@ -356,7 +356,7 @@ describe Vagrant::Action::Builtin::BoxAdd do it "add from shorthand path with configured server url" do box_path = iso_env.box2_file(:virtualbox) td = Pathname.new(Dir.mktmpdir) - tf = td.join("api", "v1", "vagrant", "mitchellh", "precise64.json") + tf = td.join("mitchellh", "precise64.json") tf.dirname.mkpath tf.open("w") do |f| f.write(<<-RAW) @@ -380,7 +380,7 @@ describe Vagrant::Action::Builtin::BoxAdd do RAW end - with_web_server(td) do |port| + with_web_server(tf.dirname) do |port| url = "http://127.0.0.1:#{port}" env[:box_url] = "mitchellh/precise64.json" env[:box_server_url] = url @@ -390,7 +390,7 @@ describe Vagrant::Action::Builtin::BoxAdd do expect(version).to eq("0.7") expect(checksum(path)).to eq(checksum(box_path)) expect(opts[:metadata_url]).to eq( - "#{url}/api/v1/vagrant/#{env[:box_url]}") + "#{url}/#{env[:box_url]}") true }.and_return(box) @@ -558,11 +558,10 @@ describe Vagrant::Action::Builtin::BoxAdd do end it "raises an error if shorthand is invalid" do - td = Pathname.new(Dir.mktmpdir) - tf = td.join("api", "v1", "vagrant", "foo") - tf.dirname.mkpath + tf = Tempfile.new("foo") + tf.close - with_web_server(td) do |port| + with_web_server(Pathname.new(tf.path)) do |port| env[:box_url] = "mitchellh/precise64.json" expect(box_collection).to receive(:add).never From ef7cf679dcdd8983ac71da750d598d2a49f9e632 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 3 Feb 2015 06:40:16 +0100 Subject: [PATCH 21/30] Revet CHANGELOG --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5240e2430..5a6f2acff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ BUG FIXES: - core: push configurations are validated with global configs [GH-5130] - core: remove executable permissions on internal file [GH-5220] - core: check name and version in `has_plugin?` [GH-5218] - - core: use new Atlas APIs for downloading boxes [GH-5274] - core/cli: fix box checksum validation [GH-4665, GH-5221] - hosts/nfs: allow colons (`:`) in NFS IDs [GH-5222] - guests/funtoo: fix incorrect path in configure networks [GH-4812] From 52d0df329685b32c0805e0a209a001eb0690a9f1 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 3 Feb 2015 19:19:08 -0500 Subject: [PATCH 22/30] Add --message option to `vagrant push` --- plugins/commands/push/command.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/commands/push/command.rb b/plugins/commands/push/command.rb index 902a0c946..f76d5a5d2 100644 --- a/plugins/commands/push/command.rb +++ b/plugins/commands/push/command.rb @@ -9,8 +9,17 @@ module VagrantPlugins # @todo support multiple strategies if requested by the community def execute + options = {} + opts = OptionParser.new do |o| o.banner = "Usage: vagrant push [strategy] [options]" + o.separator "" + o.separator "Options:" + o.separator "" + + o.on("-m", "--message BODY", "Text to identify this push") do |m| + options[:message] = m + end end # Parse the options From edbc3e74d4a99836fbac8b25b382547cab16077d Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 3 Feb 2015 19:19:51 -0500 Subject: [PATCH 23/30] Pass metadata to push command --- plugins/pushes/atlas/push.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/pushes/atlas/push.rb b/plugins/pushes/atlas/push.rb index 8a892fa2c..7def5077f 100644 --- a/plugins/pushes/atlas/push.rb +++ b/plugins/pushes/atlas/push.rb @@ -27,6 +27,7 @@ module VagrantPlugins cmd << "-vcs" if config.vcs cmd += config.includes.map { |v| ["-include", v] } cmd += config.excludes.map { |v| ["-exclude", v] } + cmd += metadata.map { |k,v| ["-metadata", "#{k}=#{v}"] } cmd += ["-address", config.address] if config.address cmd += ["-token", config.token] if config.token cmd << config.app @@ -53,6 +54,16 @@ module VagrantPlugins return Vagrant::Util::Which.which(UPLOADER_BIN) end + + # The metadata command for this push. + # + # @return [Array] + def metadata + hash = { + "box" => env.vagrantfile.config.vm.box, + "box_url" => env.vagrantfile.config.vm.box_url, + }.reject { |k,v| v.nil? || v.empty? } + end end end end From 0dde0b3756d0a2770ff6736f605c4dede70d0af8 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 3 Feb 2015 19:19:58 -0500 Subject: [PATCH 24/30] Use a real iso env for push tests --- test/unit/plugins/pushes/atlas/push_test.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/unit/plugins/pushes/atlas/push_test.rb b/test/unit/plugins/pushes/atlas/push_test.rb index e7ffdebd5..b59b2bde0 100644 --- a/test/unit/plugins/pushes/atlas/push_test.rb +++ b/test/unit/plugins/pushes/atlas/push_test.rb @@ -8,10 +8,17 @@ describe VagrantPlugins::AtlasPush::Push do let(:bin) { VagrantPlugins::AtlasPush::Push::UPLOADER_BIN } + # let(:env) do + # double("env", + # root_path: File.expand_path("..", __FILE__) + # ) + # end + let(:env) do - double("env", - root_path: File.expand_path("..", __FILE__) - ) + # We have to create a Vagrantfile so there is a root path + env = isolated_environment + env.vagrantfile("") + env.create_vagrant_env end let(:config) do From d29a474fbb90ad701f6a274bf866d1e795cc3fc1 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 3 Feb 2015 19:20:12 -0500 Subject: [PATCH 25/30] Cleanup that syntax --- plugins/pushes/atlas/push.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/pushes/atlas/push.rb b/plugins/pushes/atlas/push.rb index 7def5077f..e44f65364 100644 --- a/plugins/pushes/atlas/push.rb +++ b/plugins/pushes/atlas/push.rb @@ -41,8 +41,7 @@ module VagrantPlugins # @return [String] def uploader_path # Determine the uploader path - uploader = config.uploader_path - if uploader + if uploader = config.uploader_path return uploader end From 82b24e9a8fe6c27a498b707e40793f5f8abf0612 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 3 Feb 2015 19:20:27 -0500 Subject: [PATCH 26/30] Pass in a message to the command as well --- plugins/pushes/atlas/push.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/pushes/atlas/push.rb b/plugins/pushes/atlas/push.rb index e44f65364..323f070f5 100644 --- a/plugins/pushes/atlas/push.rb +++ b/plugins/pushes/atlas/push.rb @@ -30,6 +30,7 @@ module VagrantPlugins cmd += metadata.map { |k,v| ["-metadata", "#{k}=#{v}"] } cmd += ["-address", config.address] if config.address cmd += ["-token", config.token] if config.token + cmd += ["-message", message] if message cmd << config.app cmd << File.expand_path(config.dir, env.root_path) Vagrant::Util::SafeExec.exec(uploader, *cmd.flatten) From 257ff57772733fcb0ee01f1db236ff3cd0530137 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 3 Feb 2015 21:06:51 -0500 Subject: [PATCH 27/30] Remove message for now --- plugins/commands/push/command.rb | 9 --------- plugins/pushes/atlas/push.rb | 1 - 2 files changed, 10 deletions(-) diff --git a/plugins/commands/push/command.rb b/plugins/commands/push/command.rb index f76d5a5d2..902a0c946 100644 --- a/plugins/commands/push/command.rb +++ b/plugins/commands/push/command.rb @@ -9,17 +9,8 @@ module VagrantPlugins # @todo support multiple strategies if requested by the community def execute - options = {} - opts = OptionParser.new do |o| o.banner = "Usage: vagrant push [strategy] [options]" - o.separator "" - o.separator "Options:" - o.separator "" - - o.on("-m", "--message BODY", "Text to identify this push") do |m| - options[:message] = m - end end # Parse the options diff --git a/plugins/pushes/atlas/push.rb b/plugins/pushes/atlas/push.rb index 323f070f5..e44f65364 100644 --- a/plugins/pushes/atlas/push.rb +++ b/plugins/pushes/atlas/push.rb @@ -30,7 +30,6 @@ module VagrantPlugins cmd += metadata.map { |k,v| ["-metadata", "#{k}=#{v}"] } cmd += ["-address", config.address] if config.address cmd += ["-token", config.token] if config.token - cmd += ["-message", message] if message cmd << config.app cmd << File.expand_path(config.dir, env.root_path) Vagrant::Util::SafeExec.exec(uploader, *cmd.flatten) From 7d25a687ca34da229fd79828483e649f50455678 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 4 Feb 2015 11:45:02 -0500 Subject: [PATCH 28/30] Add tests for sending metadata --- plugins/pushes/atlas/push.rb | 18 ++++++++--- test/unit/plugins/pushes/atlas/push_test.rb | 36 +++++++++++++++------ 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/plugins/pushes/atlas/push.rb b/plugins/pushes/atlas/push.rb index e44f65364..73ec117b9 100644 --- a/plugins/pushes/atlas/push.rb +++ b/plugins/pushes/atlas/push.rb @@ -58,10 +58,20 @@ module VagrantPlugins # # @return [Array] def metadata - hash = { - "box" => env.vagrantfile.config.vm.box, - "box_url" => env.vagrantfile.config.vm.box_url, - }.reject { |k,v| v.nil? || v.empty? } + box = env.vagrantfile.config.vm.box + box_url = env.vagrantfile.config.vm.box_url + + result = {} + + if !box.nil? && !box.empty? + result["box"] = box + end + + if !box_url.nil? && !box_url.empty? + result["box_url"] = Array(box_url).first + end + + return result end end end diff --git a/test/unit/plugins/pushes/atlas/push_test.rb b/test/unit/plugins/pushes/atlas/push_test.rb index b59b2bde0..72eb46057 100644 --- a/test/unit/plugins/pushes/atlas/push_test.rb +++ b/test/unit/plugins/pushes/atlas/push_test.rb @@ -8,17 +8,10 @@ describe VagrantPlugins::AtlasPush::Push do let(:bin) { VagrantPlugins::AtlasPush::Push::UPLOADER_BIN } - # let(:env) do - # double("env", - # root_path: File.expand_path("..", __FILE__) - # ) - # end - let(:env) do - # We have to create a Vagrantfile so there is a root path - env = isolated_environment - env.vagrantfile("") - env.create_vagrant_env + iso_env = isolated_environment + iso_env.vagrantfile("") + iso_env.create_vagrant_env end let(:config) do @@ -106,6 +99,29 @@ describe VagrantPlugins::AtlasPush::Push do config.token = "atlas_token" subject.execute("foo") end + + context "when metadata is available" do + let(:env) do + iso_env = isolated_environment + iso_env.vagrantfile <<-EOH + Vagrant.configure(2) do |config| + config.vm.box = "hashicorp/precise64" + config.vm.box_url = "https://atlas.hashicorp.com/hashicorp/precise64" + end + EOH + iso_env.create_vagrant_env + end + + it "sends the metadata" do + expect(Vagrant::Util::SafeExec).to receive(:exec). + with("foo", "-vcs", "-metadata", "box=hashicorp/precise64", + "-metadata", "box_url=https://atlas.hashicorp.com/hashicorp/precise64", + "-token", "atlas_token", app, env.root_path.to_s) + + config.token = "atlas_token" + subject.execute("foo") + end + end end describe "#uploader_path" do From b2c722ef54e57c9de5cdbe712b27e52faacec5da Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 4 Feb 2015 13:30:24 -0500 Subject: [PATCH 29/30] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a6f2acff..bcc3bcdce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ BUG FIXES: - provisioners/ansible: fix SSH settings to support more than 5 ssh keys [GH-5017] - provisioners/ansible: increase ansible connection timeout to 30 seconds [GH-5018] - provisioners/docker: use docker.com instead of docker.io [GH-5216] + - pushes/atlas: send additional box metadata [GH-5283] ## 1.7.2 (January 6, 2015) From a755cf285a5ee716663ee77808840626ac94c356 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 9 Feb 2015 09:40:20 -0500 Subject: [PATCH 30/30] Clarify first sentence about project setup --- website/docs/source/v2/getting-started/project_setup.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/source/v2/getting-started/project_setup.html.md b/website/docs/source/v2/getting-started/project_setup.html.md index 1a2029bd1..3d1bc2706 100644 --- a/website/docs/source/v2/getting-started/project_setup.html.md +++ b/website/docs/source/v2/getting-started/project_setup.html.md @@ -5,8 +5,8 @@ sidebar_current: "gettingstarted-projectsetup" # Project Setup -The first step for any project to use Vagrant is to configure Vagrant -using a [Vagrantfile](/v2/vagrantfile/index.html). The purpose of the +The first step in configuring any Vagrant project is to create a +[Vagrantfile](/v2/vagrantfile/index.html). The purpose of the Vagrantfile is twofold: 1. Mark the root directory of your project. A lot of the configuration