vagrant-zones 0.1.98 → 0.1.100
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/CHANGELOG.md +19 -0
- data/Gemfile +1 -0
- data/lib/vagrant-zones/action/import.rb +1 -1
- data/lib/vagrant-zones/driver.rb +95 -26
- data/lib/vagrant-zones/version.rb +1 -1
- data/vagrant-zones.gemspec +1 -0
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f3b4be02798563d9d0f4fce9a66a07ac6cd1ea7ef09edfdeb4f9fe232a67341
|
4
|
+
data.tar.gz: 9ed384b15f7ee5d4f81552116580fb94c72aa9dcff84f644d8d74e9fa4db7d66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bf472087023060df2fe90c19a12410cf7e73b805dc78e3f1de4addf173466b50306257dfacabfb436d016b359b65f39a37a490fd7eaf77a0a3d26ed18e38643
|
7
|
+
data.tar.gz: faea40fce30d5dfc5be5915ec4c68c11d8df94afcc846707fbcad16818e0396b1209e4dc9fbb473ac147be574b4faded2fb5a63f90e23f1325c3177e69ab192a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.1.100](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.99...v0.1.100) (2025-05-09)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* adding ansi-strings to fix issue with windows output ([bc67454](https://github.com/STARTcloud/vagrant-zones/commit/bc674546d79419496bb781c7aabf2004126c29a5))
|
9
|
+
* linting file ([0455ae0](https://github.com/STARTcloud/vagrant-zones/commit/0455ae0677dc593dea0b43f66ac64ba1930b274f))
|
10
|
+
* linting file ([9996594](https://github.com/STARTcloud/vagrant-zones/commit/999659499ca65153527ac9222a500b0fefaf0014))
|
11
|
+
* linting file ([0e6c345](https://github.com/STARTcloud/vagrant-zones/commit/0e6c34515147617d6f0d233d7400d65515eea2cd))
|
12
|
+
|
13
|
+
## [0.1.99](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.98...v0.1.99) (2025-05-04)
|
14
|
+
|
15
|
+
|
16
|
+
### Bug Fixes
|
17
|
+
|
18
|
+
* null vlans ([ef22b48](https://github.com/STARTcloud/vagrant-zones/commit/ef22b481a3e8293039b371dd49db00f87c71923f))
|
19
|
+
* rubocop linting errors ([48530c4](https://github.com/STARTcloud/vagrant-zones/commit/48530c41be5e46123d8773abdf651ff5ca0c879b))
|
20
|
+
* rubocop linting errors ([018b555](https://github.com/STARTcloud/vagrant-zones/commit/018b5551eaf64de5e404e6abee32f9257c214f07))
|
21
|
+
|
3
22
|
## [0.1.98](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.97...v0.1.98) (2024-10-11)
|
4
23
|
|
5
24
|
|
data/Gemfile
CHANGED
@@ -66,7 +66,7 @@ module VagrantPlugins
|
|
66
66
|
ratelimit += 1
|
67
67
|
if ratelimit >= rate
|
68
68
|
uiprogress.clear_line
|
69
|
-
status = format('%.2f%%',
|
69
|
+
status = format('%.2f%%', amount_downloaded.to_f / file_size * 100)
|
70
70
|
uiprogress.info(I18n.t('vagrant_zones.importing_joyent_image') + "#{image} ==> ", new_line: false)
|
71
71
|
uiprogress.report_progress(status, 100, false)
|
72
72
|
ratelimit = 0
|
data/lib/vagrant-zones/driver.rb
CHANGED
@@ -15,6 +15,7 @@ require 'resolv'
|
|
15
15
|
require 'vagrant-zones/util/timer'
|
16
16
|
require 'vagrant-zones/util/subprocess'
|
17
17
|
require 'vagrant/util/retryable'
|
18
|
+
require 'strings/ansi'
|
18
19
|
|
19
20
|
module VagrantPlugins
|
20
21
|
module ProviderZone
|
@@ -727,7 +728,7 @@ module VagrantPlugins
|
|
727
728
|
uii.info(I18n.t('vagrant_zones.creating_vnic'))
|
728
729
|
uii.info(" #{vnic_name}")
|
729
730
|
command = "#{@pfexec} dladm create-vnic -l #{opts[:bridge]} -m #{mac}"
|
730
|
-
command += " -v #{opts[:vlan]}" unless opts[:vlan].nil? ||
|
731
|
+
command += " -v #{opts[:vlan]}" unless opts[:vlan].nil? || opts[:vlan].zero?
|
731
732
|
command += " #{vnic_name}"
|
732
733
|
execute(false, command)
|
733
734
|
end
|
@@ -928,9 +929,9 @@ module VagrantPlugins
|
|
928
929
|
## zonecfg function for CPU Configurations
|
929
930
|
def zonecfgcpu(uii, _name, config, zcfg)
|
930
931
|
uii.info(I18n.t('vagrant_zones.zonecfgcpu')) if config.debug
|
931
|
-
if config.cpu_configuration == 'simple' &&
|
932
|
+
if config.cpu_configuration == 'simple' && %w[bhyve kvm].include?(config.brand)
|
932
933
|
execute(false, %(#{zcfg}"add attr; set name=vcpus; set value=#{config.cpus}; set type=string; end;"))
|
933
|
-
elsif config.cpu_configuration == 'complex' &&
|
934
|
+
elsif config.cpu_configuration == 'complex' && %w[bhyve kvm].include?(config.brand)
|
934
935
|
hash = config.complex_cpu_conf[0]
|
935
936
|
cstring = %(sockets=#{hash['sockets']},cores=#{hash['cores']},threads=#{hash['threads']})
|
936
937
|
execute(false, %(#{zcfg}'add attr; set name=vcpus; set value="#{cstring}"; set type=string; end;'))
|
@@ -1054,15 +1055,15 @@ module VagrantPlugins
|
|
1054
1055
|
shrtstr2 = %(add property (name=ips,value="#{allowed_address}"); add property (name=primary,value="true"); end;)
|
1055
1056
|
execute(false, %(#{zonecfg_cmd}set global-nic=auto; #{shrtstr1} #{shrtstr2}"))
|
1056
1057
|
when 'bhyve'
|
1057
|
-
vlan_option = opts[:vlan].nil? || opts[:vlan].zero? ? '' : "set vlan-id=#{opts[:vlan]};
|
1058
|
+
vlan_option = opts[:vlan].nil? || opts[:vlan].zero? ? '' : "set vlan-id=#{opts[:vlan]};"
|
1058
1059
|
base_cmd = if config.on_demand_vnics
|
1059
|
-
%(
|
1060
|
+
%(add net; set physical=#{vnic_name}; #{vlan_option} set global-nic=#{opts[:bridge]};)
|
1060
1061
|
else
|
1061
|
-
%(
|
1062
|
+
%(add net; set physical=#{vnic_name};)
|
1062
1063
|
end
|
1063
|
-
execute(false, %(#{base_cmd}end;)) unless cie
|
1064
|
-
execute(false, %(#{base_cmd}set allowed-address=#{allowed_address}; end;)) if cie && aa
|
1065
|
-
execute(false, %(#{base_cmd}end;)) if cie && !aa
|
1064
|
+
execute(false, %(#{zonecfg_cmd} "#{base_cmd} end;")) unless cie
|
1065
|
+
execute(false, %(#{zonecfg_cmd} "#{base_cmd} set allowed-address=#{allowed_address}; end;")) if cie && aa
|
1066
|
+
execute(false, %(#{zonecfg_cmd} "#{base_cmd} end;")) if cie && !aa
|
1066
1067
|
end
|
1067
1068
|
end
|
1068
1069
|
|
@@ -1129,7 +1130,7 @@ module VagrantPlugins
|
|
1129
1130
|
|
1130
1131
|
## This setups the Netplan based OS Networking via Zlogin
|
1131
1132
|
def zoneniczloginsetup_netplan(uii, opts, mac)
|
1132
|
-
zlogin(uii, 'rm -rf /etc/netplan/*.yaml') if
|
1133
|
+
zlogin(uii, 'rm -rf /etc/netplan/*.yaml') if opts[:nic_number].zero?
|
1133
1134
|
ip = ipaddress(uii, opts)
|
1134
1135
|
vnic_name = vname(uii, opts)
|
1135
1136
|
servers = dnsservers(uii, opts).map { |server| server['nameserver'] }.join(', ') unless opts[:dns].nil?
|
@@ -1344,20 +1345,88 @@ module VagrantPlugins
|
|
1344
1345
|
uii.info(I18n.t('vagrant_zones.configure_win_interface_using_vnic'))
|
1345
1346
|
sleep(60)
|
1346
1347
|
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1348
|
+
# Get the MAC address for this VNIC (if set to auto)
|
1349
|
+
mac = macaddress(uii, opts)
|
1350
|
+
if mac == 'auto'
|
1351
|
+
mac = ''
|
1352
|
+
cmd = "#{@pfexec} dladm show-vnic #{vnic_name} | tail -n +2 | awk '{ print $4 }'"
|
1353
|
+
vnicmac = execute(false, cmd.to_s)
|
1354
|
+
vnicmac.split(':').each { |x| mac += "#{format('%02x', x.to_i(16))}:" }
|
1355
|
+
mac = mac[0..-2]
|
1356
|
+
end
|
1357
|
+
|
1358
|
+
# Normalize the MAC address to uppercase with hyphens (Windows format)
|
1359
|
+
normalized_mac = mac.split(':').map { |segment| segment.rjust(2, '0') }.join('-').upcase
|
1360
|
+
|
1361
|
+
# Debug output
|
1362
|
+
uii.info("Looking for adapter with MAC: #{normalized_mac}")
|
1363
|
+
|
1364
|
+
# Use the bash command with sed to wrap adapter name with VZWI markers
|
1365
|
+
## DO NOT EVER ADJUST THIS COMMAND, WE MUST USE THIS EXACT COMMAND TO GET THE DATA FROM THE MACHINE
|
1366
|
+
## DO NOT ADJUST THE COMMAND, IT IS IMPORTANT THAT WE DO NOT EVER ADJUST THIS COMMAND
|
1367
|
+
## DO NOT ADJUST THE COMMAND
|
1368
|
+
## DO NOT ADJUST THE COMMAND!!!!!!!!!! SERIOUSLY
|
1369
|
+
getmac_cmd = %(bash -c "getmac /v /FO csv /NH | grep "#{normalized_mac}" | awk -F, '{print $1}' | sed 's/"/VZWI/g'")
|
1370
|
+
raw_output = zlogin(uii, getmac_cmd)
|
1371
|
+
|
1372
|
+
uii.info("Raw adapter result: #{raw_output.inspect}")
|
1373
|
+
|
1374
|
+
if raw_output.is_a?(String)
|
1375
|
+
hex_display = raw_output.bytes.map { |b| format('\\x%02X', b) }.join
|
1376
|
+
uii.info("Hex representation: #{hex_display}")
|
1377
|
+
elsif raw_output.is_a?(Array)
|
1378
|
+
# Handle array case
|
1379
|
+
hex_display = raw_output.join.bytes.map { |b| format('\\x%02X', b) }.join
|
1380
|
+
uii.info("Hex representation (array joined): #{hex_display}")
|
1381
|
+
end
|
1382
|
+
|
1383
|
+
# Use the strings-ansi gem to sanitize the raw output
|
1384
|
+
adapter_name = nil
|
1385
|
+
|
1386
|
+
# First sanitize the raw output to remove all ANSI escape sequences
|
1387
|
+
raw_output_str = raw_output.is_a?(Array) ? raw_output.join : raw_output.to_s
|
1388
|
+
sanitized_output = Strings::ANSI.sanitize(raw_output_str)
|
1389
|
+
|
1390
|
+
# Debug the sanitized output
|
1391
|
+
uii.info("Sanitized output: #{sanitized_output.inspect}")
|
1392
|
+
|
1393
|
+
# Find VZWI markers in the sanitized output
|
1394
|
+
sanitized_output.split(/[\r\n]+/).each do |line|
|
1395
|
+
next unless line.include?('VZWI')
|
1396
|
+
|
1397
|
+
uii.info("Found line with VZWI markers (sanitized): #{line}")
|
1398
|
+
|
1399
|
+
# Extract the adapter name between VZWI markers using direct match
|
1400
|
+
if line =~ /VZWI(.+?)VZWI/
|
1401
|
+
adapter_name = ::Regexp.last_match(1)
|
1402
|
+
uii.info("Extracted adapter name from sanitized output: '#{adapter_name}'")
|
1403
|
+
end
|
1404
|
+
break
|
1405
|
+
end
|
1406
|
+
|
1407
|
+
# Only proceed if we got a valid adapter name
|
1408
|
+
if adapter_name && !adapter_name.empty?
|
1409
|
+
# Rename the adapter to the VNIC name
|
1410
|
+
uii.info("Using extracted adapter name '#{adapter_name}' for rename")
|
1411
|
+
rename_adapter = %(netsh interface set interface name="#{adapter_name}" newname="#{vnic_name}")
|
1412
|
+
uii.info(I18n.t('vagrant_zones.win_applied_rename_adapter')) if zlogin(uii, rename_adapter)
|
1413
|
+
|
1414
|
+
# Configure the interface with IP, mask, and gateway
|
1415
|
+
cmd = %(netsh interface ipv4 set address name="#{vnic_name}" static #{ip} #{opts[:netmask]} #{defrouter})
|
1416
|
+
uii.info(I18n.t('vagrant_zones.win_applied_static')) if zlogin(uii, cmd)
|
1417
|
+
|
1418
|
+
# Configure DNS if provided
|
1419
|
+
unless opts[:dns].nil?
|
1420
|
+
ip_addresses = dnsservers(uii, opts).map { |hash| hash['nameserver'] }
|
1421
|
+
dns1 = %(netsh int ipv4 set dns name="#{vnic_name}" static #{ip_addresses[0]} primary validate=no)
|
1422
|
+
uii.info(I18n.t('vagrant_zones.win_applied_dns1')) if zlogin(uii, dns1)
|
1423
|
+
ip_addresses[1..].each_with_index do |dns, index|
|
1424
|
+
additional_nameservers = %(netsh int ipv4 add dns name="#{vnic_name}" #{dns} index="#{index + 2}" validate=no)
|
1425
|
+
uii.info(I18n.t('vagrant_zones.win_applied_dns2')) if zlogin(uii, additional_nameservers)
|
1426
|
+
end
|
1427
|
+
end
|
1428
|
+
else
|
1429
|
+
uii.info('Could not extract adapter name from output')
|
1361
1430
|
end
|
1362
1431
|
end
|
1363
1432
|
|
@@ -1644,7 +1713,7 @@ module VagrantPlugins
|
|
1644
1713
|
uii.info(I18n.t('vagrant_zones.cron_entries'))
|
1645
1714
|
h = { h: 'hourly', d: 'daily', w: 'weekly', m: 'monthly' }
|
1646
1715
|
h.each do |(_k, d)|
|
1647
|
-
next unless
|
1716
|
+
next unless [d, 'all'].include?(opts[:list])
|
1648
1717
|
|
1649
1718
|
uii.info(cronjobs[d.to_sym]) unless cronjobs[d.to_sym].nil?
|
1650
1719
|
end
|
@@ -1659,7 +1728,7 @@ module VagrantPlugins
|
|
1659
1728
|
h = { h: 'hourly', d: 'daily', w: 'weekly', m: 'monthly' }
|
1660
1729
|
uii.info(I18n.t('vagrant_zones.cron_delete'))
|
1661
1730
|
h.each do |(_k, d)|
|
1662
|
-
next unless
|
1731
|
+
next unless [d, 'all'].include?(opts[:delete])
|
1663
1732
|
|
1664
1733
|
cj = cronjobs[d.to_sym].to_s.gsub('*', '\*')
|
1665
1734
|
rc = "#{rmcr}'#{cj}' | #{sc}"
|
data/vagrant-zones.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-zones
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.100
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Gilbert
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -92,6 +92,20 @@ dependencies:
|
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: 1.7.5
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: strings-ansi
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.2.0
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 0.2.0
|
95
109
|
description: Vagrant provider plugin to support zones
|
96
110
|
email:
|
97
111
|
- support@prominic.net
|
@@ -176,7 +190,7 @@ metadata:
|
|
176
190
|
documentation_uri: http://rubydoc.info/gems/vagrant-zones
|
177
191
|
source_code_uri: https://github.com/STARTCloud/vagrant-zones
|
178
192
|
github_repo: https://github.com/STARTCloud/vagrant-zones
|
179
|
-
post_install_message:
|
193
|
+
post_install_message:
|
180
194
|
rdoc_options: []
|
181
195
|
require_paths:
|
182
196
|
- lib
|
@@ -192,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
206
|
version: 1.3.6
|
193
207
|
requirements: []
|
194
208
|
rubygems_version: 3.2.3
|
195
|
-
signing_key:
|
209
|
+
signing_key:
|
196
210
|
specification_version: 4
|
197
211
|
summary: Vagrant provider plugin to support zones
|
198
212
|
test_files: []
|