vagrant-veertu 0.0.12 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/lib/vagrant-veertu/action.rb +4 -0
- data/lib/vagrant-veertu/action/check_veertu.rb +2 -2
- data/lib/vagrant-veertu/action/customize.rb +2 -2
- data/lib/vagrant-veertu/action/export.rb +3 -2
- data/lib/vagrant-veertu/action/forced_halt.rb +1 -1
- data/lib/vagrant-veertu/action/forward_ports.rb +1 -1
- data/lib/vagrant-veertu/action/network.rb +12 -12
- data/lib/vagrant-veertu/action/network_fix_ipv6.rb +1 -1
- data/lib/vagrant-veertu/action/prepare_nfs_settings.rb +4 -4
- data/lib/vagrant-veertu/action/sane_defaults.rb +2 -2
- data/lib/vagrant-veertu/config.rb +16 -16
- data/lib/vagrant-veertu/driver/base.rb +2 -2
- data/lib/vagrant-veertu/driver/meta.rb +8 -8
- data/lib/vagrant-veertu/driver/version_5_0.rb +37 -11
- data/lib/vagrant-veertu/errors.rb +3 -0
- data/lib/vagrant-veertu/model/forwarded_port.rb +1 -1
- data/lib/vagrant-veertu/provider.rb +10 -10
- data/lib/vagrant-veertu/synced_folder.rb +7 -7
- data/lib/vagrant-veertu/version.rb +1 -1
- data/locales/en.yml +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3bb7fba0711390479da3fb382a57199a529185f
|
4
|
+
data.tar.gz: 9957d516b85e7ecf0484c955598e271fe38c8bee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e8873e36590077513aa5765d065d149fc53ee3939662bd7e767ab40b367da3efcdcdbfa509dbfc6d9c1a94b848e3d5186e50573171fd02ab83f6794a99add8
|
7
|
+
data.tar.gz: 5f7e18a06bf5ec55785b1b5ba6399a8f8b86237d338c21e0029a1c5d893909211236110aae825cfa8c2d800b70c7b4fb47608fe8daf25f3236ba71c9579ea938
|
data/Gemfile
CHANGED
@@ -54,6 +54,10 @@ module VagrantPlugins
|
|
54
54
|
b.use EnvSet, port_collision_repair: true
|
55
55
|
b.use PrepareForwardedPortCollisionParams
|
56
56
|
b.use HandleForwardedPortCollisions
|
57
|
+
b.use PrepareNFSValidIds
|
58
|
+
b.use SyncedFolderCleanup
|
59
|
+
b.use SyncedFolders
|
60
|
+
b.use PrepareNFSSettings
|
57
61
|
b.use Network
|
58
62
|
b.use NetworkFixIPv6
|
59
63
|
b.use ForwardPorts
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module ProviderVeertu
|
3
3
|
module Action
|
4
|
-
# Checks that
|
4
|
+
# Checks that Veertu is installed and ready to be used.
|
5
5
|
class CheckVeertu
|
6
6
|
def initialize(app, env)
|
7
7
|
@app = app
|
8
8
|
end
|
9
9
|
|
10
10
|
def call(env)
|
11
|
-
# This verifies that
|
11
|
+
# This verifies that Veertu is installed and the driver is
|
12
12
|
# ready to function. If not, then an exception will be raised
|
13
13
|
# which will break us out of execution of the middleware sequence.
|
14
14
|
Driver::Meta.new.verify!
|
@@ -8,7 +8,7 @@ module VagrantPlugins
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def call(env)
|
11
|
-
|
11
|
+
|
12
12
|
|
13
13
|
customizations = []
|
14
14
|
env[:machine].provider_config.customizations.each do |event, command|
|
@@ -28,7 +28,7 @@ module VagrantPlugins
|
|
28
28
|
begin
|
29
29
|
env[:machine].provider.driver.execute_command(
|
30
30
|
processed_command + [retryable: true])
|
31
|
-
rescue Vagrant::Errors::
|
31
|
+
rescue Vagrant::Errors::VeertuManageError => e
|
32
32
|
raise Vagrant::Errors::VMCustomizationFailed, {
|
33
33
|
command: command,
|
34
34
|
error: e.inspect
|
@@ -6,6 +6,7 @@ module VagrantPlugins
|
|
6
6
|
class Export
|
7
7
|
def initialize(app, env)
|
8
8
|
@app = app
|
9
|
+
@logger = Log4r::Logger.new("vagrant::provider::veertu_5_0")
|
9
10
|
end
|
10
11
|
|
11
12
|
def call(env)
|
@@ -24,7 +25,7 @@ module VagrantPlugins
|
|
24
25
|
@env[:ui].info I18n.t("vagrant.actions.vm.export.exporting")
|
25
26
|
@env[:machine].provider.driver.export(ovf_path) do |progress|
|
26
27
|
@env[:ui].clear_line
|
27
|
-
@env[:ui].report_progress(progress
|
28
|
+
@env[:ui].report_progress(progress, 100, false)
|
28
29
|
end
|
29
30
|
|
30
31
|
# Clear the line a final time so the next data can appear
|
@@ -33,7 +34,7 @@ module VagrantPlugins
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def ovf_path
|
36
|
-
File.join(@env["export.temp_dir"], "box.
|
37
|
+
File.join(@env["export.temp_dir"], "box.vmz")
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -46,7 +46,7 @@ module VagrantPlugins
|
|
46
46
|
}
|
47
47
|
|
48
48
|
# Assuming the only reason to establish port forwarding is
|
49
|
-
# because the VM is using
|
49
|
+
# because the VM is using Veertu NAT networking. Host-only
|
50
50
|
# bridged networking don't require port-forwarding and establishing
|
51
51
|
# forwarded ports on these attachment types has uncertain behaviour.
|
52
52
|
@env[:ui].detail(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry",
|
@@ -9,7 +9,7 @@ require "vagrant/util/scoped_hash_override"
|
|
9
9
|
module VagrantPlugins
|
10
10
|
module ProviderVeertu
|
11
11
|
module Action
|
12
|
-
# This middleware class sets up all networking for the
|
12
|
+
# This middleware class sets up all networking for the Veertu
|
13
13
|
# instance. This includes host only networks, bridged networking,
|
14
14
|
# forwarded ports, etc.
|
15
15
|
#
|
@@ -49,7 +49,7 @@ module VagrantPlugins
|
|
49
49
|
slot = options[:adapter]
|
50
50
|
if !slot
|
51
51
|
if available_slots.empty?
|
52
|
-
raise Vagrant::Errors::
|
52
|
+
raise Vagrant::Errors::VeertuNoRoomForHighLevelNetwork
|
53
53
|
end
|
54
54
|
|
55
55
|
slot = available_slots.shift
|
@@ -91,7 +91,7 @@ module VagrantPlugins
|
|
91
91
|
config[:adapter] = slot
|
92
92
|
@logger.debug("Normalized configuration: #{config.inspect}")
|
93
93
|
|
94
|
-
# Get the
|
94
|
+
# Get the Veertu adapter configuration
|
95
95
|
adapter = send("#{type}_adapter", config)
|
96
96
|
adapters << adapter
|
97
97
|
@logger.debug("Adapter configuration: #{adapter.inspect}")
|
@@ -108,7 +108,7 @@ module VagrantPlugins
|
|
108
108
|
env[:ui].output(I18n.t("vagrant.actions.vm.network.preparing"))
|
109
109
|
adapters.each do |adapter|
|
110
110
|
env[:ui].detail(I18n.t(
|
111
|
-
"vagrant.
|
111
|
+
"vagrant.veertu.network_adapter",
|
112
112
|
adapter: adapter[:adapter].to_s,
|
113
113
|
type: adapter[:type].to_s,
|
114
114
|
extra: "",
|
@@ -270,7 +270,7 @@ module VagrantPlugins
|
|
270
270
|
#
|
271
271
|
# If the subnets overlap in any way then the host only network
|
272
272
|
# will not work because the routing tables will force the
|
273
|
-
# traffic onto the real interface rather than the
|
273
|
+
# traffic onto the real interface rather than the Veertu
|
274
274
|
# interface.
|
275
275
|
@env[:machine].provider.driver.read_bridged_interfaces.each do |interface|
|
276
276
|
that_netaddr = network_address(interface[:ip], interface[:netmask])
|
@@ -491,9 +491,9 @@ module VagrantPlugins
|
|
491
491
|
# DHCP Server Helper Functions
|
492
492
|
#-----------------------------------------------------------------
|
493
493
|
|
494
|
-
|
495
|
-
network_name: 'HostInterfaceNetworking-
|
496
|
-
network: '
|
494
|
+
DEFAULT_DHCP_SERVER_FROM_VEERTU_INSTALL = {
|
495
|
+
network_name: 'HostInterfaceNetworking-veertunet0',
|
496
|
+
network: 'veertunet0',
|
497
497
|
ip: '192.168.56.100',
|
498
498
|
netmask: '255.255.255.0',
|
499
499
|
lower: '192.168.56.101',
|
@@ -502,7 +502,7 @@ module VagrantPlugins
|
|
502
502
|
|
503
503
|
#
|
504
504
|
# When a host-only network of type: :dhcp is configured,
|
505
|
-
# this handles the potential creation of a
|
505
|
+
# this handles the potential creation of a veertu dhcpserver to manage
|
506
506
|
# it.
|
507
507
|
#
|
508
508
|
# @param [Hash<String>] interface hash as returned from read_host_only_interfaces
|
@@ -514,13 +514,13 @@ module VagrantPlugins
|
|
514
514
|
if dhcp_server_matches_config?(existing_dhcp_server, config)
|
515
515
|
@logger.debug("DHCP server already properly configured")
|
516
516
|
return
|
517
|
-
elsif existing_dhcp_server ==
|
518
|
-
@env[:ui].info I18n.t("vagrant.actions.vm.network.
|
517
|
+
elsif existing_dhcp_server == DEFAULT_DHCP_SERVER_FROM_VEERTU_INSTALL
|
518
|
+
@env[:ui].info I18n.t("vagrant.actions.vm.network.cleanup_veertu_default_dhcp")
|
519
519
|
@env[:machine].provider.driver.remove_dhcp_server(existing_dhcp_server[:network_name])
|
520
520
|
else
|
521
521
|
# We have an invalid DHCP server that we're not able to
|
522
522
|
# automatically clean up, so we need to give up and tell the user
|
523
|
-
# to sort out their own
|
523
|
+
# to sort out their own veertu dhcpservers and hostonlyifs
|
524
524
|
raise Vagrant::Errors::NetworkDHCPAlreadyAttached
|
525
525
|
end
|
526
526
|
end
|
@@ -9,7 +9,7 @@ require "vagrant/util/scoped_hash_override"
|
|
9
9
|
module VagrantPlugins
|
10
10
|
module ProviderVeertu
|
11
11
|
module Action
|
12
|
-
# This middleware works around a bug in
|
12
|
+
# This middleware works around a bug in Veertu where booting
|
13
13
|
# a VM with an IPv6 host-only network will someties lose the
|
14
14
|
# route to that machine.
|
15
15
|
class NetworkFixIPv6
|
@@ -82,7 +82,7 @@ module VagrantPlugins
|
|
82
82
|
ips
|
83
83
|
end
|
84
84
|
|
85
|
-
# Returns the IP address of the guest by looking at
|
85
|
+
# Returns the IP address of the guest by looking at veertu guest property
|
86
86
|
# for the appropriate guest adapter.
|
87
87
|
#
|
88
88
|
# For DHCP interfaces, the guest property will not be present until the
|
@@ -93,17 +93,17 @@ module VagrantPlugins
|
|
93
93
|
def read_dynamic_machine_ip(adapter)
|
94
94
|
return nil unless adapter
|
95
95
|
|
96
|
-
#
|
96
|
+
# veertu guest properties are 0-indexed, while showvminfo network
|
97
97
|
# interfaces are 1-indexed. go figure.
|
98
98
|
guestproperty_adapter = adapter - 1
|
99
99
|
|
100
100
|
# we need to wait for the guest's IP to show up as a guest property.
|
101
101
|
# retry thresholds are relatively high since we might need to wait
|
102
102
|
# for DHCP, but even static IPs can take a second or two to appear.
|
103
|
-
retryable(retry_options.merge(on: Vagrant::Errors::
|
103
|
+
retryable(retry_options.merge(on: Vagrant::Errors::VeertuGuestPropertyNotFound)) do
|
104
104
|
@machine.provider.driver.read_guest_ip(guestproperty_adapter)
|
105
105
|
end
|
106
|
-
rescue Vagrant::Errors::
|
106
|
+
rescue Vagrant::Errors::VeertuGuestPropertyNotFound
|
107
107
|
# this error is more specific with a better error message directing
|
108
108
|
# the user towards the fact that it's probably a reportable bug
|
109
109
|
raise Vagrant::Errors::NFSNoGuestIP
|
@@ -55,7 +55,7 @@ module VagrantPlugins
|
|
55
55
|
begin
|
56
56
|
@env[:machine].provider.driver.execute_command(
|
57
57
|
command + [retryable: true])
|
58
|
-
rescue Vagrant::Errors::
|
58
|
+
rescue Vagrant::Errors::VeertuManageError => e
|
59
59
|
@logger.info("#{log} (error = #{e.inspect})")
|
60
60
|
end
|
61
61
|
end
|
@@ -72,7 +72,7 @@ module VagrantPlugins
|
|
72
72
|
if contents =~ /^nameserver 127\.0\.(0|1)\.1$/
|
73
73
|
# The use of both natdnsproxy and natdnshostresolver break on
|
74
74
|
# Ubuntu 12.04 and 12.10 that uses resolvconf with localhost. When used
|
75
|
-
#
|
75
|
+
# Veertu will give the client dns server 10.0.2.3, while
|
76
76
|
# not binding to that address itself. Therefore disable this
|
77
77
|
# feature if host uses the resolvconf server 127.0.0.1 or
|
78
78
|
# 127.0.1.1
|
@@ -28,7 +28,7 @@ module VagrantPlugins
|
|
28
28
|
# @return [Boolean]
|
29
29
|
attr_accessor :destroy_unused_network_interfaces
|
30
30
|
|
31
|
-
# If set to `true`, then
|
31
|
+
# If set to `true`, then Veertu will be launched with a GUI.
|
32
32
|
#
|
33
33
|
# @return [Boolean]
|
34
34
|
attr_accessor :gui
|
@@ -47,18 +47,18 @@ module VagrantPlugins
|
|
47
47
|
# @return [String]
|
48
48
|
attr_accessor :linked_clone_snapshot
|
49
49
|
|
50
|
-
# This should be set to the name of the machine in the
|
50
|
+
# This should be set to the name of the machine in the Veertu
|
51
51
|
# GUI.
|
52
52
|
#
|
53
53
|
# @return [String]
|
54
54
|
attr_accessor :name
|
55
55
|
|
56
|
-
# Whether or not this VM has a functional
|
57
|
-
# This defaults to true. If you set this to false, then the "
|
56
|
+
# Whether or not this VM has a functional veertusf filesystem module.
|
57
|
+
# This defaults to true. If you set this to false, then the "veertu"
|
58
58
|
# synced folder type won't be valid.
|
59
59
|
#
|
60
60
|
# @return [Boolean]
|
61
|
-
attr_accessor :
|
61
|
+
attr_accessor :functional_veertusf
|
62
62
|
|
63
63
|
# The defined network adapters.
|
64
64
|
#
|
@@ -70,7 +70,7 @@ module VagrantPlugins
|
|
70
70
|
@check_guest_additions = UNSET_VALUE
|
71
71
|
@customizations = []
|
72
72
|
@destroy_unused_network_interfaces = UNSET_VALUE
|
73
|
-
@
|
73
|
+
@functional_veertusf = false
|
74
74
|
@name = UNSET_VALUE
|
75
75
|
@network_adapters = {}
|
76
76
|
@gui = UNSET_VALUE
|
@@ -99,7 +99,7 @@ module VagrantPlugins
|
|
99
99
|
@customizations << [event, command]
|
100
100
|
end
|
101
101
|
|
102
|
-
# This defines a network adapter that will be added to the
|
102
|
+
# This defines a network adapter that will be added to the Veertu
|
103
103
|
# virtual machine in the given slot.
|
104
104
|
#
|
105
105
|
# @param [Integer] slot The slot for this network adapter.
|
@@ -113,7 +113,7 @@ module VagrantPlugins
|
|
113
113
|
#
|
114
114
|
# @param size [Integer, String] the memory size in MB
|
115
115
|
def memory=(size)
|
116
|
-
customize("pre-boot", ["
|
116
|
+
customize("pre-boot", ["modify", :id, "set", "--ram", size.to_s + "MB"])
|
117
117
|
end
|
118
118
|
|
119
119
|
# Shortcut for setting CPU count for the virtual machine.
|
@@ -121,7 +121,7 @@ module VagrantPlugins
|
|
121
121
|
#
|
122
122
|
# @param count [Integer, String] the count of CPUs
|
123
123
|
def cpus=(count)
|
124
|
-
customize("pre-boot", ["
|
124
|
+
customize("pre-boot", ["modify", :id, "set", "--cpu", count.to_i])
|
125
125
|
end
|
126
126
|
|
127
127
|
def merge(other)
|
@@ -146,8 +146,8 @@ module VagrantPlugins
|
|
146
146
|
@destroy_unused_network_interfaces = false
|
147
147
|
end
|
148
148
|
|
149
|
-
if @
|
150
|
-
@
|
149
|
+
if @functional_veertusf == UNSET_VALUE
|
150
|
+
@functional_veertusf = true
|
151
151
|
end
|
152
152
|
|
153
153
|
# Default is to not show a GUI
|
@@ -168,7 +168,7 @@ module VagrantPlugins
|
|
168
168
|
@customizations.each do |event, _|
|
169
169
|
if !valid_events.include?(event)
|
170
170
|
errors << I18n.t(
|
171
|
-
"vagrant.
|
171
|
+
"vagrant.veertu.config.invalid_event",
|
172
172
|
event: event.to_s,
|
173
173
|
valid_events: valid_events.join(", "))
|
174
174
|
end
|
@@ -176,23 +176,23 @@ module VagrantPlugins
|
|
176
176
|
|
177
177
|
@customizations.each do |event, command|
|
178
178
|
if event == "pre-import" && command.index(:id)
|
179
|
-
errors << I18n.t("vagrant.
|
179
|
+
errors << I18n.t("vagrant.veertu.config.id_in_pre_import")
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
183
|
# Verify that internal networks are only on private networks.
|
184
184
|
machine.config.vm.networks.each do |type, data|
|
185
185
|
if data[:veertu__intnet] && type != :private_network
|
186
|
-
errors << I18n.t("vagrant.
|
186
|
+
errors << I18n.t("vagrant.veertu.config.intnet_on_bad_type")
|
187
187
|
break
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
-
{ "
|
191
|
+
{ "Veertu Provider" => errors }
|
192
192
|
end
|
193
193
|
|
194
194
|
def to_s
|
195
|
-
"
|
195
|
+
"Veertu"
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
@@ -124,7 +124,7 @@ module VagrantPlugins
|
|
124
124
|
end
|
125
125
|
|
126
126
|
# Returns a list of all UUIDs of virtual machines currently
|
127
|
-
# known by
|
127
|
+
# known by Veertu.
|
128
128
|
#
|
129
129
|
# @return [Array<String>]
|
130
130
|
def read_vms
|
@@ -231,7 +231,7 @@ module VagrantPlugins
|
|
231
231
|
Vagrant::Util::Subprocess.execute(@veertumanage_path, *command, &block)
|
232
232
|
end
|
233
233
|
rescue Vagrant::Util::Subprocess::LaunchError => e
|
234
|
-
raise Vagrant::Errors::
|
234
|
+
raise Vagrant::Errors::VeertuManageLaunchError,
|
235
235
|
message: e.to_s
|
236
236
|
end
|
237
237
|
end
|
@@ -18,7 +18,7 @@ module VagrantPlugins
|
|
18
18
|
# We use forwardable to do all our driver forwarding
|
19
19
|
extend Forwardable
|
20
20
|
|
21
|
-
# We cache the read
|
21
|
+
# We cache the read Veertu version here once we have one,
|
22
22
|
# since during the execution of Vagrant, it likely doesn't change.
|
23
23
|
@@version = nil
|
24
24
|
@@version_lock = Mutex.new
|
@@ -26,7 +26,7 @@ module VagrantPlugins
|
|
26
26
|
# The UUID of the virtual machine we represent
|
27
27
|
attr_reader :uuid
|
28
28
|
|
29
|
-
# The version of
|
29
|
+
# The version of veertu that is running.
|
30
30
|
attr_reader :version
|
31
31
|
|
32
32
|
include Vagrant::Util::Retryable
|
@@ -40,15 +40,15 @@ module VagrantPlugins
|
|
40
40
|
|
41
41
|
@@version_lock.synchronize do
|
42
42
|
if !@@version
|
43
|
-
# Read and assign the version of
|
43
|
+
# Read and assign the version of Veertu we know which
|
44
44
|
# specific driver to instantiate.
|
45
45
|
begin
|
46
46
|
@@version = read_version
|
47
47
|
rescue Vagrant::Errors::CommandUnavailable,
|
48
48
|
Vagrant::Errors::CommandUnavailableWindows
|
49
|
-
# This means that
|
49
|
+
# This means that Veertu was not found, so we raise this
|
50
50
|
# error here.
|
51
|
-
raise Vagrant::Errors::
|
51
|
+
raise Vagrant::Errors::VeertuNotDetected
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -69,11 +69,11 @@ module VagrantPlugins
|
|
69
69
|
|
70
70
|
if !driver_klass
|
71
71
|
supported_versions = driver_map.keys.sort.join(", ")
|
72
|
-
raise Vagrant::Errors::
|
72
|
+
raise Vagrant::Errors::VeertuInvalidVersion,
|
73
73
|
supported_versions: supported_versions
|
74
74
|
end
|
75
75
|
|
76
|
-
@logger.info("Using
|
76
|
+
@logger.info("Using Veertu driver: #{driver_klass}")
|
77
77
|
@driver = driver_klass.new(@uuid)
|
78
78
|
@version = @@version
|
79
79
|
|
@@ -131,7 +131,7 @@ module VagrantPlugins
|
|
131
131
|
|
132
132
|
protected
|
133
133
|
|
134
|
-
# This returns the version of
|
134
|
+
# This returns the version of Veertu that is running.
|
135
135
|
#
|
136
136
|
# @return [String]
|
137
137
|
def read_version
|
@@ -22,7 +22,7 @@ module VagrantPlugins
|
|
22
22
|
|
23
23
|
def clear_forwarded_ports
|
24
24
|
read_forwarded_ports(@uuid).each do |nic, name, _, _|
|
25
|
-
execute("modify", @uuid, 'delete', '
|
25
|
+
execute("modify", @uuid, 'delete', 'port_forwarding', name)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -35,18 +35,18 @@ module VagrantPlugins
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def export(path)
|
38
|
-
execute("export", @uuid,
|
38
|
+
execute("export", @uuid, path.to_s, '--fmt=box')
|
39
39
|
end
|
40
40
|
|
41
41
|
def forward_ports(ports)
|
42
42
|
ports.each do |options|
|
43
43
|
name = options[:name]
|
44
44
|
protocol = options[:protocol] || "tcp"
|
45
|
-
host_ip = options[:hostip] || "
|
45
|
+
host_ip = options[:hostip] || "0"
|
46
46
|
host_port = options[:hostport]
|
47
47
|
guest_ip = options[:guestip] || ""
|
48
48
|
guest_port = options[:guestport]
|
49
|
-
execute('--machine-readable', 'modify', @uuid, 'add', '
|
49
|
+
execute('--machine-readable', 'modify', @uuid, 'add', 'port_forwarding', name, '--host-ip',
|
50
50
|
host_ip, '--host-port', host_port.to_s, '--protocol', protocol, '--guest-ip',
|
51
51
|
guest_ip, '--guest-port', guest_port.to_s)
|
52
52
|
|
@@ -59,7 +59,7 @@ module VagrantPlugins
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def set_name(name)
|
62
|
-
execute('modify', @uuid, 'set', '--
|
62
|
+
execute('modify', @uuid, 'set', '--name', name)
|
63
63
|
end
|
64
64
|
|
65
65
|
def halt
|
@@ -77,8 +77,9 @@ module VagrantPlugins
|
|
77
77
|
@logger.debug("Doing dry-run import to determine parallel-safe name...")
|
78
78
|
output = execute("import", "-n", box)
|
79
79
|
result = /Suggested VM name "(.+?)"/.match(output)
|
80
|
+
puts result
|
80
81
|
if !result
|
81
|
-
raise
|
82
|
+
raise Errors::VeertuManageNoNameError, output: output
|
82
83
|
end
|
83
84
|
suggested_name = result[1].to_s
|
84
85
|
|
@@ -221,12 +222,12 @@ module VagrantPlugins
|
|
221
222
|
end
|
222
223
|
json_success = execute('--machine-readable', 'start', @uuid)
|
223
224
|
result = JSON.parse(json_success)
|
224
|
-
if result['status'] == '
|
225
|
+
if result['status'] == 'OK'
|
225
226
|
return true
|
226
227
|
end
|
227
228
|
|
228
229
|
# If we reached this point then it didn't work out.
|
229
|
-
raise Vagrant::Errors::
|
230
|
+
raise Vagrant::Errors::VeertuManageError,
|
230
231
|
command: command.inspect,
|
231
232
|
stderr: r.stderr
|
232
233
|
end
|
@@ -253,18 +254,32 @@ module VagrantPlugins
|
|
253
254
|
end
|
254
255
|
|
255
256
|
# If we reach this point, it means that we consistently got the
|
256
|
-
# failure, do a standard
|
257
|
+
# failure, do a standard veertumanage now. This will raise an
|
257
258
|
# exception if it fails again.
|
258
259
|
execute("show", uuid)
|
259
260
|
return true
|
260
261
|
end
|
261
262
|
|
263
|
+
def read_mac_address
|
264
|
+
vm_describe = get_vm_describe(@uuid)
|
265
|
+
network_cards = vm_describe["network cards"]
|
266
|
+
if not network_cards
|
267
|
+
return nil
|
268
|
+
end
|
269
|
+
if network_cards.is_a?(Hash)
|
270
|
+
network_card = network_cards
|
271
|
+
else
|
272
|
+
network_card = network_cards.pop(0)
|
273
|
+
end
|
274
|
+
puts network_card
|
275
|
+
return network_card['mac address']
|
276
|
+
end
|
262
277
|
protected
|
263
278
|
|
264
279
|
def get_vm_list()
|
265
280
|
vms_json = execute("--machine-readable", "list", retryable: true)
|
266
281
|
vms = JSON.parse(vms_json)
|
267
|
-
return vms
|
282
|
+
return vms['body']
|
268
283
|
end
|
269
284
|
|
270
285
|
def get_vm_info(uuid)
|
@@ -272,12 +287,23 @@ module VagrantPlugins
|
|
272
287
|
begin
|
273
288
|
vm_info_json = execute('--machine-readable', 'show', uuid, retryable: true)
|
274
289
|
vm_info = JSON.parse(vm_info_json)
|
275
|
-
|
290
|
+
body = vm_info['body']
|
291
|
+
return body
|
276
292
|
rescue JSON::ParserError
|
277
293
|
return nil
|
278
294
|
end
|
279
295
|
end
|
280
296
|
|
297
|
+
def get_vm_describe(uuid)
|
298
|
+
begin
|
299
|
+
vm_info_json = execute('--machine-readable', 'describe', uuid, retryable: true)
|
300
|
+
vm_info = JSON.parse(vm_info_json)
|
301
|
+
body = vm_info['body']
|
302
|
+
return body
|
303
|
+
rescue JSON::ParserError
|
304
|
+
return nil
|
305
|
+
end
|
306
|
+
end
|
281
307
|
end
|
282
308
|
end
|
283
309
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module ProviderVeertu
|
3
3
|
module Model
|
4
|
-
# Represents a single forwarded port for
|
4
|
+
# Represents a single forwarded port for Veertu. This has various
|
5
5
|
# helpers and defaults for a forwarded port.
|
6
6
|
class ForwardedPort
|
7
7
|
# The NAT adapter on which to attach the forwarded port.
|
@@ -8,21 +8,21 @@ module VagrantPlugins
|
|
8
8
|
def self.installed?
|
9
9
|
Driver::Meta.new
|
10
10
|
true
|
11
|
-
rescue Vagrant::Errors::
|
11
|
+
rescue Vagrant::Errors::VeertuInvalidVersion
|
12
12
|
return false
|
13
|
-
rescue Vagrant::Errors::
|
13
|
+
rescue Vagrant::Errors::VeertuNotDetected
|
14
14
|
return false
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.usable?(raise_error=false)
|
18
|
-
# Instantiate the driver, which will determine the
|
19
|
-
# version and all that, which checks for
|
18
|
+
# Instantiate the driver, which will determine the Veertu
|
19
|
+
# version and all that, which checks for Veertu being present
|
20
20
|
Driver::Meta.new
|
21
21
|
true
|
22
|
-
rescue Vagrant::Errors::
|
22
|
+
rescue Vagrant::Errors::VeertuInvalidVersion
|
23
23
|
raise if raise_error
|
24
24
|
return false
|
25
|
-
rescue Vagrant::Errors::
|
25
|
+
rescue Vagrant::Errors::VeertuNotDetected
|
26
26
|
raise if raise_error
|
27
27
|
return false
|
28
28
|
end
|
@@ -63,7 +63,7 @@ module VagrantPlugins
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
# Returns the SSH info for accessing the
|
66
|
+
# Returns the SSH info for accessing the Veertu VM.
|
67
67
|
def ssh_info
|
68
68
|
# If the VM is not running that we can't possibly SSH into it
|
69
69
|
return nil if state.id != :running
|
@@ -81,10 +81,10 @@ module VagrantPlugins
|
|
81
81
|
def state
|
82
82
|
#puts caller
|
83
83
|
# We have to check if the UID matches to avoid issues with
|
84
|
-
#
|
84
|
+
# Veertu.
|
85
85
|
uid = @machine.uid
|
86
86
|
if uid && uid.to_s != Process.uid.to_s
|
87
|
-
raise Vagrant::Errors::
|
87
|
+
raise Vagrant::Errors::VeertuUserMismatch,
|
88
88
|
original_uid: uid.to_s,
|
89
89
|
uid: Process.uid.to_s
|
90
90
|
end
|
@@ -114,7 +114,7 @@ module VagrantPlugins
|
|
114
114
|
# @return [String]
|
115
115
|
def to_s
|
116
116
|
id = @machine.id ? @machine.id : "new VM"
|
117
|
-
"
|
117
|
+
"Veertu (#{id})"
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -4,13 +4,13 @@ module VagrantPlugins
|
|
4
4
|
module ProviderVeertu
|
5
5
|
class SyncedFolder < Vagrant.plugin("2", :synced_folder)
|
6
6
|
def usable?(machine, raise_errors=false)
|
7
|
-
# These synced folders only work if the provider if
|
8
|
-
return false if machine.provider_name != :
|
7
|
+
# These synced folders only work if the provider if Veertu
|
8
|
+
return false if machine.provider_name != :veertu
|
9
9
|
|
10
10
|
# This only happens with `vagrant package --base`. Sigh.
|
11
11
|
return true if !machine.provider_config
|
12
12
|
|
13
|
-
machine.provider_config.
|
13
|
+
machine.provider_config.functional_veertusf
|
14
14
|
end
|
15
15
|
|
16
16
|
def prepare(machine, folders, _opts)
|
@@ -49,7 +49,7 @@ module VagrantPlugins
|
|
49
49
|
|
50
50
|
# Mount the actual folder
|
51
51
|
machine.guest.capability(
|
52
|
-
:
|
52
|
+
:mount_veertu_shared_folder,
|
53
53
|
os_friendly_id(id), data[:guestpath], data)
|
54
54
|
else
|
55
55
|
# If no guest path is specified, then automounting is disabled
|
@@ -60,10 +60,10 @@ module VagrantPlugins
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def disable(machine, folders, _opts)
|
63
|
-
if machine.guest.capability?(:
|
63
|
+
if machine.guest.capability?(:unmount_veertu_shared_folder)
|
64
64
|
folders.each do |id, data|
|
65
65
|
machine.guest.capability(
|
66
|
-
:
|
66
|
+
:unmount_veertu_shared_folder,
|
67
67
|
data[:guestpath], data)
|
68
68
|
end
|
69
69
|
end
|
@@ -89,7 +89,7 @@ module VagrantPlugins
|
|
89
89
|
end
|
90
90
|
|
91
91
|
# share_folders sets up the shared folder definitions on the
|
92
|
-
#
|
92
|
+
# Veertu VM.
|
93
93
|
#
|
94
94
|
# The transient parameter determines if we're FORCING transient
|
95
95
|
# or not. If this is false, then any shared folders will be
|
data/locales/en.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-veertu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Veertu Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|