vagrant-unbundled 2.2.14.0 → 2.2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/bin/vagrant +27 -1
- data/contrib/README.md +1 -1
- data/lib/vagrant.rb +3 -1
- data/lib/vagrant/action/builtin/box_add.rb +13 -3
- data/lib/vagrant/action/builtin/box_check_outdated.rb +2 -1
- data/lib/vagrant/bundler.rb +15 -5
- data/lib/vagrant/environment.rb +1 -0
- data/lib/vagrant/errors.rb +12 -0
- data/lib/vagrant/machine_index.rb +1 -1
- data/lib/vagrant/patches/net-ssh.rb +186 -0
- data/lib/vagrant/plugin/manager.rb +20 -2
- data/lib/vagrant/util.rb +1 -0
- data/lib/vagrant/util/curl_helper.rb +7 -6
- data/lib/vagrant/util/guest_hosts.rb +1 -1
- data/lib/vagrant/util/numeric.rb +20 -0
- data/lib/vagrant/util/powershell.rb +30 -14
- data/lib/vagrant/vagrantfile.rb +1 -1
- data/plugins/commands/cloud/auth/middleware/add_authentication.rb +60 -31
- data/plugins/commands/cloud/auth/middleware/add_downloader_authentication.rb +34 -27
- data/plugins/commands/cloud/client/client.rb +10 -3
- data/plugins/commands/cloud/locales/en.yml +5 -1
- data/plugins/commands/cloud/provider/upload.rb +10 -0
- data/plugins/commands/cloud/publish.rb +10 -0
- data/plugins/commands/cloud/util.rb +10 -2
- data/plugins/commands/destroy/command.rb +1 -5
- data/plugins/guests/alpine/cap/configure_networks.rb +1 -1
- data/plugins/guests/fedora/guest.rb +4 -4
- data/plugins/guests/linux/cap/mount_smb_shared_folder.rb +1 -1
- data/plugins/guests/linux/cap/persist_mount_shared_folder.rb +1 -2
- data/plugins/guests/linux/cap/reboot.rb +21 -3
- data/plugins/guests/openwrt/cap/change_host_name.rb +19 -0
- data/plugins/guests/openwrt/cap/halt.rb +16 -0
- data/plugins/guests/openwrt/cap/insert_public_key.rb +20 -0
- data/plugins/guests/openwrt/cap/remove_public_key.rb +22 -0
- data/plugins/guests/openwrt/cap/rsync.rb +35 -0
- data/plugins/guests/openwrt/guest.rb +23 -0
- data/plugins/guests/openwrt/plugin.rb +61 -0
- data/plugins/providers/docker/driver.rb +2 -2
- data/plugins/providers/virtualbox/action/network.rb +12 -5
- data/plugins/providers/virtualbox/cap/mount_options.rb +5 -0
- data/plugins/providers/virtualbox/plugin.rb +5 -0
- data/plugins/provisioners/ansible/cap/guest/freebsd/ansible_install.rb +1 -1
- data/plugins/provisioners/salt/bootstrap-salt.sh +7 -4
- data/plugins/synced_folders/smb/cap/mount_options.rb +2 -2
- data/templates/commands/init/Vagrantfile.min.erb +3 -0
- data/templates/guests/nixos/network.erb +5 -6
- data/templates/locales/en.yml +21 -4
- data/vagrant.gemspec +5 -11
- data/version.txt +1 -1
- metadata +2921 -29
@@ -58,6 +58,16 @@ module VagrantPlugins
|
|
58
58
|
access_token: access_token
|
59
59
|
)
|
60
60
|
|
61
|
+
# Include size check on file and disable direct if over 5G
|
62
|
+
if options[:direct]
|
63
|
+
fsize = File.stat(file).size
|
64
|
+
if fsize > (5 * Vagrant::Util::Numeric::GIGABYTE)
|
65
|
+
box_size = Vagrant::Util::Numeric.bytes_to_string(fsize)
|
66
|
+
@env.ui.warn(I18n.t("cloud_command.provider.direct_disable", size: box_size))
|
67
|
+
options[:direct] = false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
61
71
|
with_provider(account: account, org: org, box: box, version: version, provider: provider) do |p|
|
62
72
|
p.upload(direct: options[:direct]) do |upload_url|
|
63
73
|
m = options[:direct] ? :put : :put
|
@@ -129,6 +129,16 @@ module VagrantPlugins
|
|
129
129
|
def upload_box_file(provider, box_file, options={})
|
130
130
|
box_file = File.absolute_path(box_file)
|
131
131
|
@env.ui.info(I18n.t("cloud_command.publish.upload_provider", file: box_file))
|
132
|
+
# Include size check on file and disable direct if over 5G
|
133
|
+
if options[:direct_upload]
|
134
|
+
fsize = File.stat(box_file).size
|
135
|
+
if fsize > (5 * Vagrant::Util::Numeric::GIGABYTE)
|
136
|
+
box_size = Vagrant::Util::Numeric.bytes_to_string(fsize)
|
137
|
+
@env.ui.warn(I18n.t("cloud_command.provider.direct_disable", size: box_size))
|
138
|
+
options[:direct_upload] = false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
132
142
|
provider.upload(direct: options[:direct_upload]) do |upload_url|
|
133
143
|
Vagrant::Util::Uploader.new(upload_url, box_file, ui: @env.ui, method: :put).upload!
|
134
144
|
end
|
@@ -5,8 +5,16 @@ module VagrantPlugins
|
|
5
5
|
def api_server_url
|
6
6
|
if Vagrant.server_url == Vagrant::DEFAULT_SERVER_URL
|
7
7
|
return "#{Vagrant.server_url}/api/v1"
|
8
|
-
|
9
|
-
|
8
|
+
end
|
9
|
+
begin
|
10
|
+
addr = URI.parse(Vagrant.server_url)
|
11
|
+
if addr.path.empty? || addr.path.to_s == "/"
|
12
|
+
addr.path = "/api/v1"
|
13
|
+
end
|
14
|
+
|
15
|
+
addr.to_s
|
16
|
+
rescue URI::Error
|
17
|
+
Vagrant.server_url
|
10
18
|
end
|
11
19
|
end
|
12
20
|
|
@@ -56,7 +56,7 @@ module VagrantPlugins
|
|
56
56
|
end
|
57
57
|
|
58
58
|
machines.each do |m|
|
59
|
-
if m.state.id == init_states[m.name]
|
59
|
+
if init_states[m.name] != :not_created && m.state.id == init_states[m.name]
|
60
60
|
declined += 1
|
61
61
|
end
|
62
62
|
end
|
@@ -64,10 +64,6 @@ module VagrantPlugins
|
|
64
64
|
# Nothing was declined
|
65
65
|
return 0 if declined == 0
|
66
66
|
|
67
|
-
# Everything was declined, and all states are `not_created`
|
68
|
-
return 0 if declined == machines.length &&
|
69
|
-
declined == init_states.values.count(:not_created)
|
70
|
-
|
71
67
|
# Everything was declined, state was not changed
|
72
68
|
return 1 if declined == machines.length
|
73
69
|
|
@@ -45,7 +45,7 @@ module VagrantPlugins
|
|
45
45
|
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
|
46
46
|
# SSH never dies.
|
47
47
|
interfaces.each do |interface|
|
48
|
-
comm.sudo("/sbin/ifdown eth#{interface} 2> /dev/null")
|
48
|
+
comm.sudo("if [[ $(/sbin/ip a show eth#{interface} | grep UP) ]]; then /sbin/ifdown eth#{interface} 2> /dev/null; fi")
|
49
49
|
comm.sudo("/sbin/ip addr flush dev eth#{interface} 2> /dev/null")
|
50
50
|
end
|
51
51
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "vagrant"
|
2
|
+
require_relative '../linux/guest'
|
2
3
|
|
3
4
|
module VagrantPlugins
|
4
5
|
module GuestFedora
|
5
|
-
class Guest <
|
6
|
-
|
7
|
-
|
8
|
-
end
|
6
|
+
class Guest < VagrantPlugins::GuestLinux::Guest
|
7
|
+
# Name used for guest detection
|
8
|
+
GUEST_DETECTION_NAME = "fedora".freeze
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -20,7 +20,7 @@ module VagrantPlugins
|
|
20
20
|
:shell_expand_guest_path, guestpath)
|
21
21
|
options[:smb_id] ||= name
|
22
22
|
|
23
|
-
mount_device = options[:plugin].capability(:mount_name, options)
|
23
|
+
mount_device = options[:plugin].capability(:mount_name, name, options)
|
24
24
|
mount_options, _, _ = options[:plugin].capability(
|
25
25
|
:mount_options, name, expanded_guest_path, options)
|
26
26
|
mount_type = options[:plugin].capability(:mount_type)
|
@@ -34,13 +34,12 @@ module VagrantPlugins
|
|
34
34
|
mount_options, _, _ = data[:plugin].capability(
|
35
35
|
:mount_options, name, guest_path, data)
|
36
36
|
if data[:plugin].capability?(:mount_name)
|
37
|
-
name = data[:plugin].capability(:mount_name, data)
|
37
|
+
name = data[:plugin].capability(:mount_name, name, data)
|
38
38
|
end
|
39
39
|
else
|
40
40
|
next
|
41
41
|
end
|
42
42
|
|
43
|
-
mount_options = "#{mount_options},nofail"
|
44
43
|
{
|
45
44
|
name: name,
|
46
45
|
mount_point: guest_path,
|
@@ -12,13 +12,16 @@ module VagrantPlugins
|
|
12
12
|
|
13
13
|
def self.reboot(machine)
|
14
14
|
@logger = Log4r::Logger.new("vagrant::linux::reboot")
|
15
|
+
reboot_script = "ps -q 1 -o comm=,start= > /tmp/.vagrant-reboot"
|
16
|
+
|
15
17
|
if systemd?(machine.communicate)
|
16
|
-
|
18
|
+
reboot_cmd = "systemctl reboot"
|
17
19
|
else
|
18
|
-
|
20
|
+
reboot_cmd = "reboot"
|
19
21
|
end
|
20
22
|
|
21
23
|
comm = machine.communicate
|
24
|
+
reboot_script += "; #{reboot_cmd}"
|
22
25
|
|
23
26
|
@logger.debug("Issuing reboot command for guest")
|
24
27
|
comm.sudo(reboot_script)
|
@@ -43,8 +46,23 @@ module VagrantPlugins
|
|
43
46
|
end
|
44
47
|
|
45
48
|
def self.wait_for_reboot(machine)
|
46
|
-
|
49
|
+
caught = false
|
50
|
+
begin
|
51
|
+
check_script = 'grep "$(ps -q 1 -o comm=,start=)" /tmp/.vagrant-reboot'
|
52
|
+
while machine.guest.ready? && machine.communicate.execute(check_script, error_check: false) == 0
|
53
|
+
sleep 10
|
54
|
+
end
|
55
|
+
rescue
|
56
|
+
# The check script execution may result in an exception
|
57
|
+
# getting raised depending on the state of the communicator
|
58
|
+
# when executing. We'll allow for it to happen once, and then
|
59
|
+
# raise if we get an exception again
|
60
|
+
if caught
|
61
|
+
raise
|
62
|
+
end
|
63
|
+
caught = true
|
47
64
|
sleep 10
|
65
|
+
retry
|
48
66
|
end
|
49
67
|
end
|
50
68
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestOpenWrt
|
3
|
+
module Cap
|
4
|
+
class ChangeHostName
|
5
|
+
def self.change_host_name(machine, name)
|
6
|
+
comm = machine.communicate
|
7
|
+
|
8
|
+
if !comm.test("uci get system.@system[0].hostname | grep '^#{name}$'", sudo: false)
|
9
|
+
comm.execute <<~EOH
|
10
|
+
uci set system.@system[0].hostname='#{name}'
|
11
|
+
uci commit system
|
12
|
+
/etc/init.d/system reload
|
13
|
+
EOH
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestOpenWrt
|
3
|
+
module Cap
|
4
|
+
class Halt
|
5
|
+
def self.halt(machine)
|
6
|
+
begin
|
7
|
+
machine.communicate.execute("halt")
|
8
|
+
rescue IOError, Vagrant::Errors::SSHDisconnected
|
9
|
+
# Ignore, this probably means connection closed because it
|
10
|
+
# shut down.
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "vagrant/util/shell_quote"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestOpenWrt
|
5
|
+
module Cap
|
6
|
+
class InsertPublicKey
|
7
|
+
def self.insert_public_key(machine, contents)
|
8
|
+
contents = contents.chomp
|
9
|
+
contents = Vagrant::Util::ShellQuote.escape(contents, "'")
|
10
|
+
|
11
|
+
machine.communicate.tap do |comm|
|
12
|
+
comm.execute <<~EOH
|
13
|
+
printf '#{contents}\\n' >> /etc/dropbear/authorized_keys
|
14
|
+
EOH
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "vagrant/util/shell_quote"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestOpenWrt
|
5
|
+
module Cap
|
6
|
+
class RemovePublicKey
|
7
|
+
def self.remove_public_key(machine, contents)
|
8
|
+
contents = contents.chomp
|
9
|
+
contents = Vagrant::Util::ShellQuote.escape(contents, "'")
|
10
|
+
|
11
|
+
machine.communicate.tap do |comm|
|
12
|
+
comm.execute <<~EOH
|
13
|
+
if test -f /etc/dropbear/authorized_keys ; then
|
14
|
+
sed -i '/^.*#{contents}.*$/d' /etc/dropbear/authorized_keys
|
15
|
+
fi
|
16
|
+
EOH
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestOpenWrt
|
3
|
+
module Cap
|
4
|
+
class RSync
|
5
|
+
def self.rsync_installed(machine)
|
6
|
+
machine.communicate.test("which rsync")
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.rsync_install(machine)
|
10
|
+
machine.communicate.tap do |comm|
|
11
|
+
comm.execute <<~EOH
|
12
|
+
opkg update
|
13
|
+
opkg install rsync
|
14
|
+
EOH
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.rsync_pre(machine, opts)
|
19
|
+
machine.communicate.tap do |comm|
|
20
|
+
comm.execute("mkdir -p '#{opts[:guestpath]}'")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.rsync_command(machine)
|
25
|
+
"rsync -zz"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.rsync_post(machine, opts)
|
29
|
+
# Don't do anything because BusyBox's `find` doesn't support the
|
30
|
+
# syntax in plugins/synced_folders/rsync/default_unix_cap.rb.
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestOpenWrt
|
3
|
+
class Guest
|
4
|
+
# Name used for guest detection
|
5
|
+
GUEST_DETECTION_NAME = "openwrt".freeze
|
6
|
+
|
7
|
+
def detect?(machine)
|
8
|
+
machine.communicate.test <<~EOH
|
9
|
+
if test -e /etc/openwrt_release; then
|
10
|
+
exit
|
11
|
+
fi
|
12
|
+
if test -r /etc/os-release; then
|
13
|
+
source /etc/os-release && test 'x#{self.class.const_get(:GUEST_DETECTION_NAME)}' = "x$ID" && exit
|
14
|
+
fi
|
15
|
+
if test -r /etc/banner; then
|
16
|
+
cat /etc/banner | grep -qi '#{self.class.const_get(:GUEST_DETECTION_NAME)}' && exit
|
17
|
+
fi
|
18
|
+
exit 1
|
19
|
+
EOH
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestOpenWrt
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
name "OpenWrt guest"
|
7
|
+
description "OpenWrt guest support."
|
8
|
+
|
9
|
+
guest(:openwrt, :linux) do
|
10
|
+
require_relative "guest"
|
11
|
+
Guest
|
12
|
+
end
|
13
|
+
|
14
|
+
guest_capability(:openwrt, :insert_public_key) do
|
15
|
+
require_relative "cap/insert_public_key"
|
16
|
+
Cap::InsertPublicKey
|
17
|
+
end
|
18
|
+
|
19
|
+
guest_capability(:openwrt, :remove_public_key) do
|
20
|
+
require_relative "cap/remove_public_key"
|
21
|
+
Cap::RemovePublicKey
|
22
|
+
end
|
23
|
+
|
24
|
+
guest_capability(:openwrt, :change_host_name) do
|
25
|
+
require_relative "cap/change_host_name"
|
26
|
+
Cap::ChangeHostName
|
27
|
+
end
|
28
|
+
|
29
|
+
guest_capability(:openwrt, :rsync_installed) do
|
30
|
+
require_relative "cap/rsync"
|
31
|
+
Cap::RSync
|
32
|
+
end
|
33
|
+
|
34
|
+
guest_capability(:openwrt, :rsync_install) do
|
35
|
+
require_relative "cap/rsync"
|
36
|
+
Cap::RSync
|
37
|
+
end
|
38
|
+
|
39
|
+
guest_capability(:openwrt, :rsync_pre) do
|
40
|
+
require_relative "cap/rsync"
|
41
|
+
Cap::RSync
|
42
|
+
end
|
43
|
+
|
44
|
+
guest_capability(:openwrt, :rsync_command) do
|
45
|
+
require_relative "cap/rsync"
|
46
|
+
Cap::RSync
|
47
|
+
end
|
48
|
+
|
49
|
+
guest_capability(:openwrt, :rsync_post) do
|
50
|
+
require_relative "cap/rsync"
|
51
|
+
Cap::RSync
|
52
|
+
end
|
53
|
+
|
54
|
+
guest_capability(:openwrt, :halt) do
|
55
|
+
require_relative "cap/halt"
|
56
|
+
Cap::Halt
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -25,9 +25,9 @@ module VagrantPlugins
|
|
25
25
|
opts = {with_stderr: true}
|
26
26
|
result = execute('docker', 'build', *args, opts, &block)
|
27
27
|
# Check for the new output format 'writing image sha256...'
|
28
|
-
# In this case, docker
|
28
|
+
# In this case, docker buildkit is enabled. Its format is different
|
29
29
|
# from standard docker
|
30
|
-
matches = result.scan(/writing image .+:([
|
30
|
+
matches = result.scan(/writing image .+:([^\s]+)/i).last
|
31
31
|
if !matches
|
32
32
|
if podman?
|
33
33
|
# Check for podman format when it is emulating docker CLI.
|
@@ -255,9 +255,17 @@ module VagrantPlugins
|
|
255
255
|
|
256
256
|
# Make sure the type is a symbol
|
257
257
|
options[:type] = options[:type].to_sym
|
258
|
-
|
259
|
-
|
260
|
-
|
258
|
+
|
259
|
+
if options[:type] == :dhcp && !options[:ip]
|
260
|
+
# Try to find a matching device to set the config ip to
|
261
|
+
matching_device = hostonly_find_matching_network(options)
|
262
|
+
if matching_device
|
263
|
+
options[:ip] = matching_device[:ip]
|
264
|
+
else
|
265
|
+
# Default IP is in the 20-bit private network block for DHCP based networks
|
266
|
+
options[:ip] = "172.28.128.1"
|
267
|
+
end
|
268
|
+
end
|
261
269
|
|
262
270
|
begin
|
263
271
|
ip = IPAddr.new(options[:ip])
|
@@ -469,7 +477,7 @@ module VagrantPlugins
|
|
469
477
|
|
470
478
|
# This finds a matching host only network for the given configuration.
|
471
479
|
def hostonly_find_matching_network(config)
|
472
|
-
this_netaddr = network_address(config[:ip], config[:netmask])
|
480
|
+
this_netaddr = network_address(config[:ip], config[:netmask]) if config[:ip]
|
473
481
|
|
474
482
|
@env[:machine].provider.driver.read_host_only_interfaces.each do |interface|
|
475
483
|
return interface if config[:name] && config[:name] == interface[:name]
|
@@ -515,7 +523,6 @@ module VagrantPlugins
|
|
515
523
|
# @param [Hash<String>] config hash as returned from hostonly_config
|
516
524
|
def create_dhcp_server_if_necessary(interface, config)
|
517
525
|
existing_dhcp_server = find_matching_dhcp_server(interface)
|
518
|
-
|
519
526
|
if existing_dhcp_server
|
520
527
|
if dhcp_server_matches_config?(existing_dhcp_server, config)
|
521
528
|
@logger.debug("DHCP server already properly configured")
|
@@ -22,6 +22,7 @@ module VagrantPlugins
|
|
22
22
|
|
23
23
|
mount_options << "uid=#{mount_uid}"
|
24
24
|
mount_options << "gid=#{mount_gid}"
|
25
|
+
mount_options << "_netdev"
|
25
26
|
mount_options = mount_options.join(',')
|
26
27
|
return mount_options, mount_uid, mount_gid
|
27
28
|
end
|
@@ -29,6 +30,10 @@ module VagrantPlugins
|
|
29
30
|
def self.mount_type(machine)
|
30
31
|
return VB_MOUNT_TYPE
|
31
32
|
end
|
33
|
+
|
34
|
+
def self.mount_name(machine, name, data)
|
35
|
+
name.gsub(/[\s\/\\]/,'_').sub(/^_/, '')
|
36
|
+
end
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|