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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e07b281bab5dd258c7b640b659c330061d87458a795247b941c05dbc6e194b84
4
- data.tar.gz: d48d93a6e9089267a6e93ddf45419fb2d8729fce1e806421e514ec0d9a81b3f2
3
+ metadata.gz: '08790ff565fafcf9be7f4019efe4d7cf0096e37accf7d8c463afeb7adab1ed14'
4
+ data.tar.gz: ae393608d7eb853c88262466d6b571249a6d1a80133818c92cdf269c38e0bccb
5
5
  SHA512:
6
- metadata.gz: '0685b5eab45e2cd3ec84f3bcca2fb6f1ca141967b832d2162b1853d91cfcd533ea98bb66fc6f01c0a17fd20ae0768baef5821d2b5fb80fefa44899d3ea264c0c'
7
- data.tar.gz: 25bcb6927db98c2e4771883796758908f56fa9a243f592dbc2af68fca2ac45084589945a974df289fa8bdbf5a1c71804b6498d60a8f71e9984cefed9d5c3f3b0
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
- brand = @machine.provider_config.brand
33
- kernel = @machine.provider_config.kernel
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
- tmp_dir = "#{Dir.pwd}/_tmp_package"
40
- Dir.mkdir(tmp_dir)
41
- datasetpath = "#{@machine.provider_config.boot['array']}/#{@machine.provider_config.boot['dataset']}/#{name}"
42
- t = Time.new
43
- datetime = %(#{t.year}-#{t.month}-#{t.day}-#{t.hour}:#{t.min}:#{t.sec})
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
- if env['package.include']
53
- extra = '_include'
54
- env['package.include'].each do |f|
55
- env[:ui].info("Including user file: #{f}")
56
- FileUtils.cp(f, tmp_dir)
57
- end
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
- ## Include Vagrant file
61
- if env['package.vagrantfile']
62
- extra = '_include'
63
- Dir.mkdir(@tmp_include) unless File.directory?(@tmp_include)
64
- env[:ui].info('Including user Vagrantfile')
65
- FileUtils.cp(env['package.vagrantfile'], "#{@tmp_include}/Vagrantfile")
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 the Metadata and Vagrantfile
69
- Dir.chdir(tmp_dir)
70
- File.write('./metadata.json', metadata_content(brand, kernel, vcc, boxshortname))
71
- File.write('./Vagrantfile', vagrantfile_content(brand, kernel, datasetpath))
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, extra)
75
- FileUtils.mv("#{tmp_dir}/#{boxname}", "../#{boxname}")
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} --nameofnewbox'")
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
- puts "#{@pfexec} zfs send -r #{datasetpath}/boot@vagrant_box#{datetime} > #{destination}" if result.zero? && config.debug
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, extra)
124
+ def assemble_box(boxname, tmp_dir)
120
125
  is_linux = `bash -c '[[ "$(uname -a)" =~ "Linux" ]]'`
121
- `tar -cvzf #{boxname} ./metadata.json ./Vagrantfile ./box.zss #{extra}` if is_linux
122
- `tar -cvzEf #{boxname} ./metadata.json ./Vagrantfile ./box.zss #{extra}` unless is_linux
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(argv, env)
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
- @subcommands.each { |(key, _value)| keys << key.to_s }
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(argv, env)
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
- @subcommands.each { |(key, _value)| keys << key.to_s }
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(argv, env)
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
- @subcommands.each { |(key, _value)| keys << key.to_s }
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(argv, env)
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
- @subcommands.each { |(key, _value)| keys << key.to_s }
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
 
@@ -17,7 +17,7 @@ module VagrantPlugins
17
17
  @additional_disks = UNSET_VALUE
18
18
  @autoboot = true
19
19
  @post_provision_boot = false
20
- @kernel = UNSET_VALUE
20
+ @kernel = nil
21
21
  @boxshortname = UNSET_VALUE
22
22
  @cdroms = nil
23
23
  @shared_dir = nil
@@ -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
- strt = "#{@pfexec} zonecfg -z #{@machine.name} "
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, %(#{strt}set global-nic=auto; #{shrtstr1} #{shrtstr2}"))
634
+ execute(false, %(#{zonecfg_cmd}set global-nic=auto; #{shrtstr1} #{shrtstr2}"))
635
635
  when 'bhyve'
636
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; end;")) unless cie
637
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set allowed-address=#{allowed_address}; end;")) if cie
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
- if opts[:vlan].nil?
728
- uii.info(I18n.t('vagrant_zones.creating_vnic'))
729
- uii.info(" #{vnic_name}")
730
- execute(false, "#{@pfexec} dladm create-vnic -l #{opts[:bridge]} -m #{mac} #{vnic_name}")
731
- else
732
- vlan = opts[:vlan]
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
- cclir['dns'].each do |ns|
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
- strt = "#{@pfexec} zonecfg -z #{@machine.name} "
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, %(#{strt}set global-nic=auto; #{shrtstr1} #{shrtstr2}"))
1055
+ execute(false, %(#{zonecfg_cmd}set global-nic=auto; #{shrtstr1} #{shrtstr2}"))
1062
1056
  when 'bhyve'
1063
- if config.on_demand_vnics && !opts[:vlan].nil?
1064
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set vlan-id=#{opts[:vlan]}; set global-nic=#{opts[:bridge]}; end;")) unless cie
1065
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set vlan-id=#{opts[:vlan]}; set global-nic=#{opts[:bridge]}; set allowed-address=#{allowed_address}; end;")) if cie && aa
1066
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set vlan-id=#{opts[:vlan]}; set global-nic=#{opts[:bridge]}; end;")) if cie && !aa
1067
- elsif config.on_demand_vnics && opts[:vlan].nil?
1068
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set global-nic=#{opts[:bridge]}; end;")) unless cie
1069
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set global-nic=#{opts[:bridge]}; set allowed-address=#{allowed_address}; end;")) if cie && aa
1070
- execute(false, %(#{strt}"add net; set physical=#{vnic_name}; set global-nic=#{opts[:bridge]}; end;")) if cie && !aa
1071
- elsif !config.on_demand_vnics
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
 
@@ -12,7 +12,7 @@ module VagrantPlugins
12
12
  def initialize(machine)
13
13
  @logger = Log4r::Logger.new('vagrant::provider::zone')
14
14
  @machine = machine
15
- super(machine)
15
+ super
16
16
  end
17
17
 
18
18
  def driver
@@ -2,7 +2,7 @@
2
2
 
3
3
  module VagrantPlugins
4
4
  module ProviderZone
5
- VERSION = '0.1.93'
5
+ VERSION = '0.1.96'
6
6
  NAME = 'vagrant-zones'
7
7
  end
8
8
  end
@@ -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.add_runtime_dependency 'i18n', '~> 1.0'
33
- spec.add_runtime_dependency 'iniparse', '~> 1.0'
34
- spec.add_runtime_dependency 'log4r', '~> 1.1'
35
- spec.add_runtime_dependency 'netaddr', '~> 2.0', '>= 2.0.4'
36
- spec.add_runtime_dependency 'ruby_expect', '~> 1.7', '>= 1.7.5'
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.93
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-01-07 00:00:00.000000000 Z
11
+ date: 2024-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n