vagrant-zones 0.1.93 → 0.1.96
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 +48 -0
- data/lib/vagrant-zones/action/package.rb +70 -62
- data/lib/vagrant-zones/command/console.rb +3 -4
- data/lib/vagrant-zones/command/guest_power_controls.rb +3 -4
- data/lib/vagrant-zones/command/zfssnapshot.rb +3 -4
- data/lib/vagrant-zones/command/zone.rb +3 -5
- data/lib/vagrant-zones/config.rb +1 -1
- data/lib/vagrant-zones/driver.rb +23 -33
- data/lib/vagrant-zones/provider.rb +1 -1
- data/lib/vagrant-zones/version.rb +1 -1
- data/vagrant-zones.gemspec +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08790ff565fafcf9be7f4019efe4d7cf0096e37accf7d8c463afeb7adab1ed14'
|
4
|
+
data.tar.gz: ae393608d7eb853c88262466d6b571249a6d1a80133818c92cdf269c38e0bccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73cd100176065cb79599347a5183167904f8db71fe4651db60f72dd67d87d98d62ffad433db78c09c75020c5611137103573ad7e338e68ea46d6fb5a95a1c751
|
7
|
+
data.tar.gz: 7ba74192089545507add98990cd383c8f44b5ba7ecc4d5011613f8c9067b6ee2d41aaa805d564724e38382710a1ac25f728581d13e96e43ed1873319c99be3ab
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,53 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.1.96](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.95...v0.1.96) (2024-08-17)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* linting ([86dc089](https://github.com/STARTcloud/vagrant-zones/commit/86dc089c8c2b3b1740fb4ef4eb315f2b2e2dd94a))
|
9
|
+
* linting ([04d665d](https://github.com/STARTcloud/vagrant-zones/commit/04d665d09e68473093a31d86e33065d7f0b698ca))
|
10
|
+
|
11
|
+
## [0.1.95](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.94...v0.1.95) (2024-08-17)
|
12
|
+
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
* linting ([d39015c](https://github.com/STARTcloud/vagrant-zones/commit/d39015c0faba337c8b197e9b35e79f4d1549daba))
|
17
|
+
* linting ([14f34e2](https://github.com/STARTcloud/vagrant-zones/commit/14f34e2c4c10e716924de77d2000618ed249b0d0))
|
18
|
+
* linting ([e908e4d](https://github.com/STARTcloud/vagrant-zones/commit/e908e4dce96a872890201cb67fadbd1fa7a69a02))
|
19
|
+
* linting ([d62952d](https://github.com/STARTcloud/vagrant-zones/commit/d62952de42a07b637a95d6433d0a5d9279b74deb))
|
20
|
+
* linting ([1403f3e](https://github.com/STARTcloud/vagrant-zones/commit/1403f3e24ca50c6878de684ec8770c1542c2798f))
|
21
|
+
* linting ([43d7ecd](https://github.com/STARTcloud/vagrant-zones/commit/43d7ecd08425149f1c262a4af83cf447b2ebd5be))
|
22
|
+
* updating vlans ([1749012](https://github.com/STARTcloud/vagrant-zones/commit/1749012ad76ec05c61ba49e66cf389f09531cfb2))
|
23
|
+
|
24
|
+
## [0.1.94](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.93...v0.1.94) (2024-01-09)
|
25
|
+
|
26
|
+
|
27
|
+
### Bug Fixes
|
28
|
+
|
29
|
+
* linting changes ([6e0ca30](https://github.com/STARTcloud/vagrant-zones/commit/6e0ca305cb708cf3e9b8856c81f232b30d1fbd34))
|
30
|
+
* linting changes ([5efd5ae](https://github.com/STARTcloud/vagrant-zones/commit/5efd5ae4df118f0236541dc2f801221732864602))
|
31
|
+
* linting changes ([b74c980](https://github.com/STARTcloud/vagrant-zones/commit/b74c9808d1867d5fa05f0193419f777da39fa5de))
|
32
|
+
* linting changes ([eeaf8eb](https://github.com/STARTcloud/vagrant-zones/commit/eeaf8eb5da9162123b7fa2be99790deac6121a28))
|
33
|
+
* linting changes ([d2e23b4](https://github.com/STARTcloud/vagrant-zones/commit/d2e23b43c20a8037a50a49ca738d8e66a3fedc61))
|
34
|
+
* linting changes ([ce961e3](https://github.com/STARTcloud/vagrant-zones/commit/ce961e3c6d96aa24f8140beb6e4f92e4974feb5b))
|
35
|
+
* linting changes ([7735b66](https://github.com/STARTcloud/vagrant-zones/commit/7735b66944efcfe62cb86a19f58f42aa7933a994))
|
36
|
+
* linting changes ([117af25](https://github.com/STARTcloud/vagrant-zones/commit/117af25973eef16eda3f3d7ec3f83ab7e2ed0f4b))
|
37
|
+
* linting changes ([50a32ec](https://github.com/STARTcloud/vagrant-zones/commit/50a32ecd3fa3704d67068c7f50803d639a205c1b))
|
38
|
+
* linting changes ([6ae3aa1](https://github.com/STARTcloud/vagrant-zones/commit/6ae3aa10a7bca6cc057091bb0af77a634cb2083d))
|
39
|
+
* linting changes ([b936a8b](https://github.com/STARTcloud/vagrant-zones/commit/b936a8b218ac4046a44b1242d98852eaab382847))
|
40
|
+
* linting changes ([5c30988](https://github.com/STARTcloud/vagrant-zones/commit/5c30988965bf396fd8744464ea16ca6260f8a406))
|
41
|
+
* linting changes ([f96e885](https://github.com/STARTcloud/vagrant-zones/commit/f96e8854a5eea2c499de3ea9b93c4e9f4349be3a))
|
42
|
+
* linting changes ([b0cc1c3](https://github.com/STARTcloud/vagrant-zones/commit/b0cc1c3577d50940badf28e60c6bbfc155ff5ffc))
|
43
|
+
* linting changes ([547d81d](https://github.com/STARTcloud/vagrant-zones/commit/547d81d564c9a241fba856748a223faf65ce7f4a))
|
44
|
+
* linting changes ([bc66f9b](https://github.com/STARTcloud/vagrant-zones/commit/bc66f9bffc7e2d4f0ff475a942c0514c4916c487))
|
45
|
+
* linting changes ([a0b7295](https://github.com/STARTcloud/vagrant-zones/commit/a0b7295ca60ecfb6ee85cb178d1d70cb217a3fb3))
|
46
|
+
* linting changes ([895fb1f](https://github.com/STARTcloud/vagrant-zones/commit/895fb1f214888128b2512df3e827b6f5fdef90c2))
|
47
|
+
* linting changes ([13893a7](https://github.com/STARTcloud/vagrant-zones/commit/13893a70d389eca1a583bd150dae35d85fd7e7db))
|
48
|
+
* linting changes ([ed04b7f](https://github.com/STARTcloud/vagrant-zones/commit/ed04b7f94c3f433eaca4ff60ff678755edebb4ef))
|
49
|
+
* packaging process ([59bbb0d](https://github.com/STARTcloud/vagrant-zones/commit/59bbb0d5a2b0fcb0f851113718eb2196725c6708))
|
50
|
+
|
3
51
|
## [0.1.93](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.92...v0.1.93) (2024-01-07)
|
4
52
|
|
5
53
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'fileutils'
|
4
|
+
require 'pathname'
|
3
5
|
require 'log4r'
|
6
|
+
require 'json'
|
4
7
|
module VagrantPlugins
|
5
8
|
module ProviderZone
|
6
9
|
module Action
|
@@ -25,58 +28,79 @@ module VagrantPlugins
|
|
25
28
|
end
|
26
29
|
|
27
30
|
def call(env)
|
28
|
-
@machine = env[:machine]
|
29
|
-
@driver = @machine.provider.driver
|
30
|
-
name = @machine.name
|
31
31
|
boxname = env['package.output']
|
32
|
-
|
33
|
-
|
34
|
-
vcc = @machine.provider_config.vagrant_cloud_creator
|
35
|
-
boxshortname = @machine.provider_config.boxshortname
|
32
|
+
mpc = env[:machine].provider_config
|
33
|
+
files = {}
|
36
34
|
raise "#{boxname}: Already exists" if File.exist?(boxname)
|
37
35
|
|
38
36
|
## Create Snapshot
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
snapshot_create(datasetpath, datetime, env[:ui], @machine.provider_config)
|
45
|
-
snapshot_send(datasetpath, "#{tmp_dir}/box.zss", datetime, env[:ui], @machine.provider_config)
|
46
|
-
## snapshot_delete(datasetpath, env[:ui], datetime)
|
47
|
-
|
48
|
-
# Package VM
|
49
|
-
extra = ''
|
37
|
+
FileUtils.mkdir_p("#{Dir.pwd}/_tmp_package")
|
38
|
+
datasetpath = "#{mpc.boot['array']}/#{mpc.boot['dataset']}/#{env[:machine].name}"
|
39
|
+
datetime = Time.new.strftime('%Y-%m-%d-%H:%M:%S')
|
40
|
+
snapshot_create(datasetpath, datetime, env[:ui], mpc)
|
41
|
+
snapshot_send(datasetpath, "#{Dir.pwd}/_tmp_package/box.zss", datetime, env[:ui], mpc)
|
50
42
|
|
51
43
|
## Include User Extra Files
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
44
|
+
env['package.include'].each do |file|
|
45
|
+
source = Pathname.new(file)
|
46
|
+
dest = if source.relative?
|
47
|
+
source
|
48
|
+
else
|
49
|
+
source.basename
|
50
|
+
end
|
51
|
+
files[file] = dest
|
52
|
+
end
|
53
|
+
|
54
|
+
# Verify the mapping
|
55
|
+
files.each_key do |from|
|
56
|
+
raise Vagrant::Errors::PackageIncludeMissing, file: from unless File.exist?(from)
|
58
57
|
end
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
files.each do |from, dest|
|
60
|
+
include_directory = Pathname.new("#{Dir.pwd}/_tmp_package/")
|
61
|
+
to = include_directory.join(dest)
|
62
|
+
FileUtils.mkdir_p(to.parent)
|
63
|
+
if File.directory?(from)
|
64
|
+
FileUtils.cp_r(Dir.glob(from), to.parent, preserve: true)
|
65
|
+
else
|
66
|
+
FileUtils.cp(from, to, preserve: true)
|
67
|
+
end
|
66
68
|
end
|
67
69
|
|
68
|
-
## Create
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
## Create a Vagrantfile or load from Users Defined File
|
71
|
+
vagrantfile_content = <<~'CODE'
|
72
|
+
require 'yaml'
|
73
|
+
require_relative 'Hosts'
|
74
|
+
settings = YAML::load(File.read("#{File.dirname(__FILE__)}/Hosts.yml"))
|
75
|
+
Vagrant.configure("2") do |config|
|
76
|
+
Hosts.configure(config, settings)
|
77
|
+
end
|
78
|
+
CODE
|
79
|
+
File.write("#{Dir.pwd}/_tmp_package/Vagrantfile", vagrantfile_content)
|
80
|
+
files[env['package.vagrantfile']] = '_Vagrantfile' if env['package.vagrantfile']
|
81
|
+
|
82
|
+
info_content_hash = {
|
83
|
+
'boxname' => boxname,
|
84
|
+
'Author' => mpc.vagrant_cloud_creator,
|
85
|
+
'Vagrant-Zones' => 'This box was built with Vagrant-Zones: https://github.com/STARTcloud/vagrant-zones'
|
86
|
+
}
|
87
|
+
File.write("#{Dir.pwd}/_tmp_package/info.json", info_content_hash.to_json)
|
88
|
+
|
89
|
+
metadata_content_hash = {
|
90
|
+
'provider' => 'zone',
|
91
|
+
'architecture' => 'amd64',
|
92
|
+
'brand' => mpc.brand,
|
93
|
+
'format' => 'zss',
|
94
|
+
'url' => "https://app.vagrantup.com/#{mpc.vagrant_cloud_creator}/boxes/#{mpc.boxshortname}"
|
95
|
+
}
|
96
|
+
metadata_content_hash['kernel'] = mpc.kernel if !mpc.kernel.nil? && mpc.kernel != false
|
97
|
+
File.write("#{Dir.pwd}/_tmp_package/metadata.json", metadata_content_hash.to_json)
|
72
98
|
|
73
99
|
## Create the Box file
|
74
|
-
assemble_box(boxname,
|
75
|
-
FileUtils.
|
76
|
-
Dir.chdir('../')
|
77
|
-
FileUtils.rm_rf(tmp_dir)
|
100
|
+
assemble_box(boxname, "#{Dir.pwd}/_tmp_package")
|
101
|
+
FileUtils.rm_rf("#{Dir.pwd}/_tmp_package")
|
78
102
|
|
79
|
-
env[:ui].info("Box created, You can now add the box: 'vagrant box add #{boxname} --
|
103
|
+
env[:ui].info("Box created, You can now add the box: 'vagrant box add #{boxname} --name newbox'")
|
80
104
|
@app.call(env)
|
81
105
|
end
|
82
106
|
|
@@ -94,32 +118,16 @@ module VagrantPlugins
|
|
94
118
|
def snapshot_send(datasetpath, destination, datetime, uii, config)
|
95
119
|
uii.info('Sending Snapshot to ZFS Send Stream image.')
|
96
120
|
result = execute(true, "#{@pfexec} zfs send #{datasetpath}/boot@vagrant_box#{datetime} > #{destination}")
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
def metadata_content(_brand, _kernel, vcc, boxshortname)
|
101
|
-
<<-ZONEBOX
|
102
|
-
{ "provider": "zone", "architecture": "amd64", "url": "https://app.vagrantup.com/#{vcc}/boxes/#{boxshortname}" }
|
103
|
-
ZONEBOX
|
104
|
-
end
|
105
|
-
|
106
|
-
def vagrantfile_content(brand, _kernel, datasetpath)
|
107
|
-
<<-ZONEBOX
|
108
|
-
Vagrant.configure('2') do |config|
|
109
|
-
config.vm.provider :zone do |zone|
|
110
|
-
zone.brand = "#{brand}"
|
111
|
-
zone.datasetpath = "#{datasetpath}"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
user_vagrantfile = File.expand_path('../_include/Vagrantfile', __FILE__)
|
115
|
-
load user_vagrantfile if File.exists?(user_vagrantfile)
|
116
|
-
ZONEBOX
|
121
|
+
uii.info("#{@pfexec} zfs send -r #{datasetpath}/boot@vagrant_box#{datetime} > #{destination}") if result.zero? && config.debug
|
117
122
|
end
|
118
123
|
|
119
|
-
def assemble_box(boxname,
|
124
|
+
def assemble_box(boxname, tmp_dir)
|
120
125
|
is_linux = `bash -c '[[ "$(uname -a)" =~ "Linux" ]]'`
|
121
|
-
|
122
|
-
|
126
|
+
Dir.chdir(tmp_dir) do
|
127
|
+
files = Dir.glob(File.join('.', '*'))
|
128
|
+
tar_command = is_linux ? 'tar -cvzf' : 'tar -cvzEf'
|
129
|
+
`#{tar_command} ../#{boxname} #{files.join(' ')}`
|
130
|
+
end
|
123
131
|
end
|
124
132
|
end
|
125
133
|
end
|
@@ -21,7 +21,7 @@ module VagrantPlugins
|
|
21
21
|
require File.expand_path('webvnc_console', __dir__)
|
22
22
|
WebVNCConsole
|
23
23
|
end
|
24
|
-
super
|
24
|
+
super
|
25
25
|
end
|
26
26
|
|
27
27
|
def execute
|
@@ -48,9 +48,8 @@ module VagrantPlugins
|
|
48
48
|
subopts.separator 'Available subcommands:'
|
49
49
|
# Add the available subcommands as separators in order to print them
|
50
50
|
# out as well.
|
51
|
-
keys =
|
52
|
-
|
53
|
-
keys.sort.each do |key|
|
51
|
+
keys = @subcommands.map { |(key, _value)| key.to_s }.sort
|
52
|
+
keys.each do |key|
|
54
53
|
subopts.separator " #{key}"
|
55
54
|
end
|
56
55
|
subopts.separator 'For help on any individual subcommand run `vagrant zone console <subcommand> -h`'
|
@@ -17,7 +17,7 @@ module VagrantPlugins
|
|
17
17
|
require File.expand_path('shutdown_guest', __dir__)
|
18
18
|
ShutdownGuest
|
19
19
|
end
|
20
|
-
super
|
20
|
+
super
|
21
21
|
end
|
22
22
|
|
23
23
|
def execute
|
@@ -42,9 +42,8 @@ module VagrantPlugins
|
|
42
42
|
subopts.separator 'Available subcommands:'
|
43
43
|
# Add the available subcommands as separators in order to print them
|
44
44
|
# out as well.
|
45
|
-
keys =
|
46
|
-
|
47
|
-
keys.sort.each do |key|
|
45
|
+
keys = @subcommands.map { |(key, _value)| key.to_s }.sort
|
46
|
+
keys.each do |key|
|
48
47
|
subopts.separator " #{key}"
|
49
48
|
end
|
50
49
|
subopts.separator ''
|
@@ -25,7 +25,7 @@ module VagrantPlugins
|
|
25
25
|
require File.expand_path('configure_snapshots', __dir__)
|
26
26
|
ConfigureSnapshots
|
27
27
|
end
|
28
|
-
super
|
28
|
+
super
|
29
29
|
end
|
30
30
|
|
31
31
|
def execute
|
@@ -51,9 +51,8 @@ module VagrantPlugins
|
|
51
51
|
subopts.separator 'Available subcommands:'
|
52
52
|
# Add the available subcommands as separators in order to print them
|
53
53
|
# out as well.
|
54
|
-
keys =
|
55
|
-
|
56
|
-
keys.sort.each do |key|
|
54
|
+
keys = @subcommands.map { |(key, _value)| key.to_s }.sort
|
55
|
+
keys.each do |key|
|
57
56
|
subopts.separator " #{key}"
|
58
57
|
end
|
59
58
|
subopts.separator ''
|
@@ -28,7 +28,7 @@ module VagrantPlugins
|
|
28
28
|
require File.expand_path('console', __dir__)
|
29
29
|
Console
|
30
30
|
end
|
31
|
-
super
|
31
|
+
super
|
32
32
|
end
|
33
33
|
|
34
34
|
def execute
|
@@ -54,10 +54,8 @@ module VagrantPlugins
|
|
54
54
|
|
55
55
|
# Add the available subcommands as separators in order to print them
|
56
56
|
# out as well.
|
57
|
-
keys =
|
58
|
-
|
59
|
-
|
60
|
-
keys.sort.each do |key|
|
57
|
+
keys = @subcommands.map { |(key, _value)| key.to_s }.sort
|
58
|
+
keys.each do |key|
|
61
59
|
subopts.separator " #{key}"
|
62
60
|
end
|
63
61
|
|
data/lib/vagrant-zones/config.rb
CHANGED
data/lib/vagrant-zones/driver.rb
CHANGED
@@ -625,16 +625,16 @@ module VagrantPlugins
|
|
625
625
|
vnic_name = vname(uii, opts)
|
626
626
|
uii.info(I18n.t('vagrant_zones.nat_vnic_setup'))
|
627
627
|
uii.info(" #{vnic_name}")
|
628
|
-
|
628
|
+
zonecfg_cmd = "#{@pfexec} zonecfg -z #{@machine.name} "
|
629
629
|
cie = config.cloud_init_enabled
|
630
630
|
case config.brand
|
631
631
|
when 'lx'
|
632
632
|
shrtstr1 = %(set allowed-address=#{allowed_address}; add property (name=gateway,value="#{defrouter}"); )
|
633
633
|
shrtstr2 = %(add property (name=ips,value="#{allowed_address}"); add property (name=primary,value="true"); end;)
|
634
|
-
execute(false, %(#{
|
634
|
+
execute(false, %(#{zonecfg_cmd}set global-nic=auto; #{shrtstr1} #{shrtstr2}"))
|
635
635
|
when 'bhyve'
|
636
|
-
execute(false, %(#{
|
637
|
-
execute(false, %(#{
|
636
|
+
execute(false, %(#{zonecfg_cmd}"add net; set physical=#{vnic_name}; end;")) unless cie
|
637
|
+
execute(false, %(#{zonecfg_cmd}"add net; set physical=#{vnic_name}; set allowed-address=#{allowed_address}; end;")) if cie
|
638
638
|
end
|
639
639
|
end
|
640
640
|
|
@@ -724,16 +724,12 @@ module VagrantPlugins
|
|
724
724
|
def zoneniccreate(uii, opts)
|
725
725
|
mac = macaddress(uii, opts)
|
726
726
|
vnic_name = vname(uii, opts)
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
uii.info(I18n.t('vagrant_zones.creating_vnic'))
|
734
|
-
uii.info(" #{vnic_name}")
|
735
|
-
execute(false, "#{@pfexec} dladm create-vnic -l #{opts[:bridge]} -m #{mac} -v #{vlan} #{vnic_name}")
|
736
|
-
end
|
727
|
+
uii.info(I18n.t('vagrant_zones.creating_vnic'))
|
728
|
+
uii.info(" #{vnic_name}")
|
729
|
+
command = "#{@pfexec} dladm create-vnic -l #{opts[:bridge]} -m #{mac}"
|
730
|
+
command += " -v #{opts[:vlan]}" unless opts[:vlan].nil? || (opts[:vlan]).zero?
|
731
|
+
command += " #{vnic_name}"
|
732
|
+
execute(false, command)
|
737
733
|
end
|
738
734
|
|
739
735
|
# This helps us create all the datasets for the zone
|
@@ -1029,10 +1025,8 @@ module VagrantPlugins
|
|
1029
1025
|
execute(false, %(#{zcfg}"add attr; set name=password; set value=#{ccip}; set type=string; end;")) unless ccip.nil?
|
1030
1026
|
|
1031
1027
|
cclir = config.dns
|
1032
|
-
dservers = []
|
1033
|
-
|
1034
|
-
dservers.append(ns['nameserver'])
|
1035
|
-
end
|
1028
|
+
dservers = cclir['dns'].map { |ns| ns['nameserver'] }
|
1029
|
+
|
1036
1030
|
uii.info(I18n.t('vagrant_zones.setting_cloud_resolvers')) unless dservers.nil?
|
1037
1031
|
uii.info(" #{dservers}") unless dservers.nil?
|
1038
1032
|
execute(false, %(#{zcfg}"add attr; set name=resolvers; set value=#{dservers}; set type=string; end;")) unless dservers.nil?
|
@@ -1051,28 +1045,24 @@ module VagrantPlugins
|
|
1051
1045
|
config = @machine.provider_config
|
1052
1046
|
uii.info(I18n.t('vagrant_zones.vnic_setup'))
|
1053
1047
|
uii.info(" #{vnic_name}")
|
1054
|
-
|
1048
|
+
zonecfg_cmd = "#{@pfexec} zonecfg -z #{@machine.name} "
|
1055
1049
|
cie = config.cloud_init_enabled
|
1056
1050
|
aa = config.allowed_address
|
1057
1051
|
case config.brand
|
1058
1052
|
when 'lx'
|
1059
1053
|
shrtstr1 = %(set allowed-address=#{allowed_address}; add property (name=gateway,value="#{defrouter}"); )
|
1060
1054
|
shrtstr2 = %(add property (name=ips,value="#{allowed_address}"); add property (name=primary,value="true"); end;)
|
1061
|
-
execute(false, %(#{
|
1055
|
+
execute(false, %(#{zonecfg_cmd}set global-nic=auto; #{shrtstr1} #{shrtstr2}"))
|
1062
1056
|
when 'bhyve'
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
execute(false, %(#{strt}"add net; set physical=#{vnic_name}; end;")) unless cie
|
1073
|
-
execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set allowed-address=#{allowed_address}; end;")) if cie && aa
|
1074
|
-
execute(false, %(#{strt}"add net; set physical=#{vnic_name}; end;")) if cie && !aa
|
1075
|
-
end
|
1057
|
+
vlan_option = opts[:vlan].nil? || opts[:vlan].zero? ? '' : "set vlan-id=#{opts[:vlan]}; "
|
1058
|
+
base_cmd = if config.on_demand_vnics
|
1059
|
+
%(#{zonecfg_cmd}"add net; set physical=#{vnic_name}; #{vlan_option}set global-nic=#{opts[:bridge]}; )
|
1060
|
+
else
|
1061
|
+
%(#{zonecfg_cmd}"add net; set physical=#{vnic_name}; )
|
1062
|
+
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
|
1076
1066
|
end
|
1077
1067
|
end
|
1078
1068
|
|
data/vagrant-zones.gemspec
CHANGED
@@ -29,9 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.required_ruby_version = '>= 2.7.0'
|
31
31
|
spec.required_rubygems_version = '>= 1.3.6'
|
32
|
-
spec.
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
spec.
|
32
|
+
spec.add_dependency 'i18n', '~> 1.0'
|
33
|
+
spec.add_dependency 'iniparse', '~> 1.0'
|
34
|
+
spec.add_dependency 'log4r', '~> 1.1'
|
35
|
+
spec.add_dependency 'netaddr', '~> 2.0', '>= 2.0.4'
|
36
|
+
spec.add_dependency 'ruby_expect', '~> 1.7', '>= 1.7.5'
|
37
37
|
end
|
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.96
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Gilbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|