vagrant-zones 0.1.94 → 0.1.97

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: 778869048e63a224ab469bebda92cd1c236c14defc620300a72033c50ccb7f6c
4
- data.tar.gz: 4eff63c5b2b5b92624bccc019e3a1cc8dd3d937ba67ed40603658f187f7475ac
3
+ metadata.gz: 6bc4c0b91b20ad53d95b7d2544e3b6766db2bb65615b5eb0d0e5196d33b7b48d
4
+ data.tar.gz: 4c134f5570b0e4fca44105f28c91a2b26291862cd5e6358dcab21e40fffadd77
5
5
  SHA512:
6
- metadata.gz: 3f7627181d958f935cfef5b30a8169c410481b463323694ec5c73dbf8ce3735bd1bc32798ee011a6e405c79d9d1658b3cf6f1336c9e7a5d6e3e737a601ef33a6
7
- data.tar.gz: 7ada33a5baa5222d69bb773876dac9ca1256dba2d00ff0f92329f78b6675d210b870d229971e3a9de383604d4bcf465c904b0c1d53033e9ddadfb7f5b42ec0eb
6
+ metadata.gz: f85d4e203831861888d8359face75ff093ea82702de832b5ade9f10757bbd896bcf60f84b1f8632f766af82415a357a8a82700ef8fa18b17de1fd42f261b3426
7
+ data.tar.gz: d78d087ce49093fc843a0f1ed4a96d95d9af91451cd8846a76b8e6b02f412b0dabeeed87853ac18f2c6b5e40c7b1e81e57a8aaf5ba26711e4f8be3d3df521bfa
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.97](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.96...v0.1.97) (2024-08-17)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add destroy confirmation ([f04e30a](https://github.com/STARTcloud/vagrant-zones/commit/f04e30a3d522dd34568fe99ce6199ae771570b4b))
9
+ * it was there all along ([7355e11](https://github.com/STARTcloud/vagrant-zones/commit/7355e11f15d932c92cf6a678dc574414620992de))
10
+ * linting - add destroy confirmation ([35786fc](https://github.com/STARTcloud/vagrant-zones/commit/35786fcd404096362211a2a07b44e901b46cc295))
11
+ * linting - add destroy confirmation ([31d0140](https://github.com/STARTcloud/vagrant-zones/commit/31d0140da06c66100e78fdd9618394d32428130b))
12
+ * linting - add destroy confirmation ([30e0324](https://github.com/STARTcloud/vagrant-zones/commit/30e0324a1b0865574d3adb95f3cffbe6656bdd05))
13
+
14
+ ## [0.1.96](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.95...v0.1.96) (2024-08-17)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * linting ([86dc089](https://github.com/STARTcloud/vagrant-zones/commit/86dc089c8c2b3b1740fb4ef4eb315f2b2e2dd94a))
20
+ * linting ([04d665d](https://github.com/STARTcloud/vagrant-zones/commit/04d665d09e68473093a31d86e33065d7f0b698ca))
21
+
22
+ ## [0.1.95](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.94...v0.1.95) (2024-08-17)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * linting ([d39015c](https://github.com/STARTcloud/vagrant-zones/commit/d39015c0faba337c8b197e9b35e79f4d1549daba))
28
+ * linting ([14f34e2](https://github.com/STARTcloud/vagrant-zones/commit/14f34e2c4c10e716924de77d2000618ed249b0d0))
29
+ * linting ([e908e4d](https://github.com/STARTcloud/vagrant-zones/commit/e908e4dce96a872890201cb67fadbd1fa7a69a02))
30
+ * linting ([d62952d](https://github.com/STARTcloud/vagrant-zones/commit/d62952de42a07b637a95d6433d0a5d9279b74deb))
31
+ * linting ([1403f3e](https://github.com/STARTcloud/vagrant-zones/commit/1403f3e24ca50c6878de684ec8770c1542c2798f))
32
+ * linting ([43d7ecd](https://github.com/STARTcloud/vagrant-zones/commit/43d7ecd08425149f1c262a4af83cf447b2ebd5be))
33
+ * updating vlans ([1749012](https://github.com/STARTcloud/vagrant-zones/commit/1749012ad76ec05c61ba49e66cf389f09531cfb2))
34
+
3
35
  ## [0.1.94](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.93...v0.1.94) (2024-01-09)
4
36
 
5
37
 
@@ -6,7 +6,7 @@ require 'log4r'
6
6
  module VagrantPlugins
7
7
  module ProviderZone
8
8
  # Run actions against the machine
9
- module Action
9
+ module Action # rubocop:disable Metrics/ModuleLength
10
10
  include Vagrant::Action::Builtin
11
11
  @logger = Log4r::Logger.new('vagrant_zones::action')
12
12
 
@@ -116,8 +116,17 @@ module VagrantPlugins
116
116
  # This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
117
117
  def self.action_destroy
118
118
  Vagrant::Action::Builder.new.tap do |b|
119
- b.use Call, IsCreated do |_env, b2|
120
- b2.use Destroy
119
+ b.use Call, IsCreated do |env1, b2|
120
+ unless env1[:result]
121
+ b2.use NotCreated
122
+ b2.use Call, DestroyConfirm do |env2, b3|
123
+ b3.use Destroy if env2[:result]
124
+ end
125
+ next
126
+ end
127
+ b2.use Call, DestroyConfirm do |env2, b3|
128
+ b3.use Destroy if env2[:result]
129
+ end
121
130
  end
122
131
  end
123
132
  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
 
@@ -315,7 +315,7 @@ module VagrantPlugins
315
315
  ## Manage Network Interfaces
316
316
  def network(uii, state)
317
317
  config = @machine.provider_config
318
- uii.info(I18n.t('vagrant_zones.creating_networking_interfaces')) if state == 'create'
318
+ uii.info(I18n.t('vagrant_zones.creating_networking_interfaces')) if state == 'create' && !config.on_demand_vnics
319
319
  @machine.config.vm.networks.each do |adaptertype, opts|
320
320
  case adaptertype.to_s
321
321
  when 'public_network'
@@ -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.94'
5
+ VERSION = '0.1.97'
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.94
4
+ version: 0.1.97
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-09 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