vagrant-zones 0.1.79 → 0.1.81

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: 38f2d5ae097c37d575d73f74b8b3ef3a73aef43f652d22908c348ae00dd6459c
4
- data.tar.gz: 25534a04b8d14f8777912cb6c1e5fbfb9a06ac96c23693bb5e20b02d8a48b744
3
+ metadata.gz: 9fc9c7fe4c46631a8db7dc8baf57efb0025326db75acb2b1185a0c898b06ed7c
4
+ data.tar.gz: 488448f55a6189c4a64a9e75cb9b94e67f3e928d6edba36d5945a650e1cf6b9f
5
5
  SHA512:
6
- metadata.gz: b2dbb2cb2549cf75269dd733f8ad19561bd8ec5a04c07d848f20cf60c001a67708cae9db8884f74f84a6ea3005aa3d80d3a3e6709499b6dfaea8d9782988727d
7
- data.tar.gz: 252af7be03ece98458b54a7dcf1edd08d63c7d381efcf3a7c3310e7bc76bc94c2b9441bec9d4c60d819b686286124a8a5cf3144a3db75e0585df6d130f2e5eac
6
+ metadata.gz: 823b3c13c827c5f085f4b2535f6cde4520123567d213dfd02f94d373ec1b2c19a7ea4750063d3a330a94196f698264e20d0620e123b0b5b4844f256d7aca560a
7
+ data.tar.gz: 5aada5d67b86bd5c7a8336715bdbb24039e0195aed71b61f0e4bbffd842e56813b59a141b971991dfa3ad0d145ed18a0c0c8cd36af8ebc108e9896c3ac26eb08
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.81](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.80...v0.1.81) (2023-12-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * double spacing ([570ae2e](https://github.com/STARTcloud/vagrant-zones/commit/570ae2e2d5f80df885eeb5cb1565f3909269be80))
9
+ * rubocop caught some junk ([ee8cbb1](https://github.com/STARTcloud/vagrant-zones/commit/ee8cbb15f7f7e3ea918cdc2a4246342aa16a0539))
10
+ * rubocop caught some junk ([25e9543](https://github.com/STARTcloud/vagrant-zones/commit/25e95432a904aee2c73e6d0b67b00f61c40ce576))
11
+ * rubocop falsepositive ([1f31eb0](https://github.com/STARTcloud/vagrant-zones/commit/1f31eb013cceb3bf7b3f3ef5fc8dfaad74b21559))
12
+
13
+ ## [0.1.80](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.79...v0.1.80) (2023-12-12)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * nameservers, windows tbu ([ac71703](https://github.com/STARTcloud/vagrant-zones/commit/ac7170336596ee4ec3179a12eb6139db6f6bae33))
19
+ * remove junk ([42b68d6](https://github.com/STARTcloud/vagrant-zones/commit/42b68d6e9e3e9a45eed0ffe65f6a0e5e04309a9d))
20
+ * rubocop linting ([123799f](https://github.com/STARTcloud/vagrant-zones/commit/123799fbe03bbedf36191ec22bc2ce878e01c8de))
21
+ * update each loops per rubocop ([646c8d3](https://github.com/STARTcloud/vagrant-zones/commit/646c8d394bdf2faf6a725e0293c7ae732dba2ef5))
22
+ * update netplan ([14fcb6e](https://github.com/STARTcloud/vagrant-zones/commit/14fcb6e6a21aeaf0a43944dc13f1b66996cc00b6))
23
+
3
24
  ## [0.1.79](https://github.com/STARTcloud/vagrant-zones/compare/v0.1.78...v0.1.79) (2023-11-27)
4
25
 
5
26
 
@@ -49,7 +49,7 @@ module VagrantPlugins
49
49
  # Add the available subcommands as separators in order to print them
50
50
  # out as well.
51
51
  keys = []
52
- @subcommands.each { |key, _value| keys << key.to_s }
52
+ @subcommands.each { |(key, _value)| keys << key.to_s }
53
53
  keys.sort.each do |key|
54
54
  subopts.separator " #{key}"
55
55
  end
@@ -43,7 +43,7 @@ module VagrantPlugins
43
43
  # Add the available subcommands as separators in order to print them
44
44
  # out as well.
45
45
  keys = []
46
- @subcommands.each { |key, _value| keys << key.to_s }
46
+ @subcommands.each { |(key, _value)| keys << key.to_s }
47
47
  keys.sort.each do |key|
48
48
  subopts.separator " #{key}"
49
49
  end
@@ -52,7 +52,7 @@ module VagrantPlugins
52
52
  # Add the available subcommands as separators in order to print them
53
53
  # out as well.
54
54
  keys = []
55
- @subcommands.each { |key, _value| keys << key.to_s }
55
+ @subcommands.each { |(key, _value)| keys << key.to_s }
56
56
  keys.sort.each do |key|
57
57
  subopts.separator " #{key}"
58
58
  end
@@ -55,7 +55,7 @@ module VagrantPlugins
55
55
  # Add the available subcommands as separators in order to print them
56
56
  # out as well.
57
57
  keys = []
58
- @subcommands.each { |key, _value| keys << key.to_s }
58
+ @subcommands.each { |(key, _value)| keys << key.to_s }
59
59
 
60
60
  keys.sort.each do |key|
61
61
  subopts.separator " #{key}"
@@ -211,8 +211,7 @@ module VagrantPlugins
211
211
  # This Sanitizes the DNS Records
212
212
  def dnsservers(uii, opts)
213
213
  config = @machine.provider_config
214
- servers = opts['dns']
215
- servers = [{ 'nameserver' => '1.1.1.1' }, { 'nameserver' => '8.8.8.8' }] if opts['dns'].nil?
214
+ servers = opts[:dns]
216
215
  uii.info(I18n.t('vagrant_zones.nsservers') + servers.to_s) if config.debug
217
216
  servers
218
217
  end
@@ -267,7 +266,7 @@ module VagrantPlugins
267
266
  alcheck = 'login:' if config.alcheck.nil?
268
267
  pcheck = 'Password:'
269
268
 
270
- @machine.config.vm.networks.each do |_adaptertype, opts|
269
+ @machine.config.vm.networks.each do |(_adaptertype, opts)|
271
270
  ip = nil
272
271
  if opts[:dhcp4] && opts[:managed]
273
272
  vnic_name = "vnic#{nictype(opts)}#{vtype(config)}_#{config.partition_id}_#{opts[:nic_number]}"
@@ -521,16 +520,16 @@ module VagrantPlugins
521
520
  defrouter = opts[:gateway].to_s
522
521
  vnic_name = vname(uii, opts)
523
522
  shrtsubnet = IPAddr.new(opts[:netmask].to_s).to_i.to_s(2).count('1').to_s
524
- servers = dnsservers(uii, opts)
523
+ servers = dnsservers(uii, opts).map { |server| server['nameserver'] }.join(', ') unless opts[:dns].nil?
525
524
  ## Begin of code block to move to Netplan function
526
525
  uii.info(I18n.t('vagrant_zones.configure_interface_using_vnic'))
527
526
  uii.info(" #{vnic_name}")
528
527
  netplan1 = %(network:\n version: 2\n ethernets:\n #{vnic_name}:\n match:\n macaddress: #{mac}\n)
529
528
  netplan2 = %( dhcp-identifier: mac\n dhcp4: #{opts[:dhcp4]}\n dhcp6: #{opts[:dhcp6]}\n)
530
- netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n gateway4: #{defrouter}\n)
531
- netplan4 = %( nameservers:\n addresses: [#{servers[0]['nameserver']} , #{servers[1]['nameserver']}] )
529
+ netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n routes:\n - to: default\n via: #{defrouter}\n)
530
+ netplan4 = %( nameservers:\n addresses: [#{servers}] ) unless opts[:dns].nil?
532
531
  netplan = netplan1 + netplan2 + netplan3 + netplan4
533
- cmd = "echo -e '#{netplan}' | sudo tee /etc/netplan/#{vnic_name}.yaml"
532
+ cmd = "echo -e '#{netplan}' | sudo tee /etc/netplan/#{vnic_name}.yaml && chmod 400 /etc/netplan/#{vnic_name}.yaml"
534
533
  uii.info(I18n.t('vagrant_zones.netplan_applied_static') + "/etc/netplan/#{vnic_name}.yaml") if ssh_run_command(uii, cmd)
535
534
 
536
535
  ## Apply the Configuration
@@ -544,7 +543,7 @@ module VagrantPlugins
544
543
  defrouter = opts[:gateway].to_s
545
544
  vnic_name = vname(uii, opts)
546
545
  shrtsubnet = IPAddr.new(opts[:netmask].to_s).to_i.to_s(2).count('1').to_s
547
- servers = dnsservers(uii, opts)
546
+ servers = dnsservers(uii, opts).map { |server| "nameserver #{server['nameserver']}" }.join("\n") unless opts[:dns].nil?
548
547
  uii.info(I18n.t('vagrant_zones.configure_interface_using_vnic_dladm'))
549
548
  uii.info(" #{vnic_name}")
550
549
 
@@ -572,8 +571,7 @@ module VagrantPlugins
572
571
  route_add = "pfexec route -p add default #{defrouter}" unless defrouter.nil?
573
572
  uii.info(I18n.t('vagrant_zones.dladm_route_applied')) if ssh_run_command(uii, route_add)
574
573
 
575
- ns_string = "nameserver #{servers[0]['nameserver']}\nnameserver #{servers[1]['nameserver']}"
576
- dns_set = "pfexec echo '#{ns_string}' | pfexec tee /etc/resolv.conf"
574
+ dns_set = "pfexec echo '#{servers}' | pfexec tee /etc/resolv.conf" unless opts[:dns].nil?
577
575
  uii.info(I18n.t('vagrant_zones.dladm_dns_applied')) if ssh_run_command(uii, dns_set.to_s)
578
576
  end
579
577
 
@@ -583,7 +581,7 @@ module VagrantPlugins
583
581
  defrouter = opts[:gateway].to_s
584
582
  vnic_name = vname(uii, opts)
585
583
  shrtsubnet = IPAddr.new(opts[:netmask].to_s).to_i.to_s(2).count('1').to_s
586
- servers = dnsservers(uii, opts)
584
+ servers = dnsservers(uii, opts).map { |server| "nameserver #{server['nameserver']}" }.join("\n") unless opts[:dns].nil?
587
585
  uii.info(I18n.t('vagrant_zones.configure_interface_using_vnic_dladm'))
588
586
  uii.info(" #{vnic_name}")
589
587
 
@@ -614,8 +612,7 @@ module VagrantPlugins
614
612
  route_add = 'echo True' if opts[:gateway].nil?
615
613
  uii.info(I18n.t('vagrant_zones.dladm_route_applied')) if zlogin(uii, route_add)
616
614
 
617
- ns_string = "nameserver #{servers[0]['nameserver']}\nnameserver #{servers[1]['nameserver']}"
618
- dns_set = "pfexec echo '#{ns_string}' | pfexec tee /etc/resolv.conf"
615
+ dns_set = "pfexec echo '#{servers}' | pfexec tee /etc/resolv.conf" unless opts[:dns].nil?
619
616
  uii.info(I18n.t('vagrant_zones.dladm_dns_applied')) if zlogin(uii, dns_set.to_s)
620
617
  end
621
618
 
@@ -1136,7 +1133,7 @@ module VagrantPlugins
1136
1133
  zlogin(uii, 'rm -rf /etc/netplan/*.yaml') if (opts[:nic_number]).zero?
1137
1134
  ip = ipaddress(uii, opts)
1138
1135
  vnic_name = vname(uii, opts)
1139
- servers = dnsservers(uii, opts)
1136
+ servers = dnsservers(uii, opts).map { |server| server['nameserver'] }.join(', ') unless opts[:dns].nil?
1140
1137
  shrtsubnet = IPAddr.new(opts[:netmask].to_s).to_i.to_s(2).count('1').to_s
1141
1138
  defrouter = opts[:gateway].to_s
1142
1139
  uii.info(I18n.t('vagrant_zones.configure_interface_using_vnic'))
@@ -1146,11 +1143,11 @@ module VagrantPlugins
1146
1143
  netplan2 = %( dhcp-identifier: mac\n dhcp4: #{opts[:dhcp4]}\n dhcp6: #{opts[:dhcp6]}\n) if opts[:dhcp4]
1147
1144
  netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n)
1148
1145
  netplan3 = %( set-name: #{vnic_name}\n) if opts[:dhcp4]
1149
- netplan4 = %( gateway4: #{defrouter}\n)
1150
- netplan5 = %( nameservers:\n addresses: [#{servers[0]['nameserver']} , #{servers[1]['nameserver']}] )
1146
+ netplan4 = %( routes:\n - to: default\n via: #{defrouter}\n)
1147
+ netplan5 = %( nameservers:\n addresses: [#{servers}] ) unless opts[:dns].nil?
1151
1148
  netplan = netplan1 + netplan2 + netplan3 + netplan5 if opts[:gateway].nil?
1152
1149
  netplan = netplan1 + netplan2 + netplan3 + netplan4 + netplan5 unless opts[:gateway].nil?
1153
- cmd = "echo '#{netplan}' > /etc/netplan/#{vnic_name}.yaml"
1150
+ cmd = "echo '#{netplan}' > /etc/netplan/#{vnic_name}.yaml && chmod 400 /etc/netplan/#{vnic_name}.yaml"
1154
1151
  infomessage = I18n.t('vagrant_zones.netplan_applied_static') + "/etc/netplan/#{vnic_name}.yaml"
1155
1152
  uii.info(infomessage) if zlogin(uii, cmd)
1156
1153
  uii.info(I18n.t('vagrant_zones.netplan_applied')) if zlogin(uii, 'netplan apply')
@@ -1330,7 +1327,7 @@ module VagrantPlugins
1330
1327
  def zoneniczloginsetup_windows(uii, opts, _mac)
1331
1328
  ip = ipaddress(uii, opts)
1332
1329
  vnic_name = vname(uii, opts)
1333
- servers = dnsservers(uii, opts)
1330
+ servers = dnsservers(uii, opts) unless opts[:dns].nil?
1334
1331
  defrouter = opts[:gateway].to_s
1335
1332
  uii.info(I18n.t('vagrant_zones.configure_win_interface_using_vnic'))
1336
1333
  sleep(60)
@@ -1339,8 +1336,8 @@ module VagrantPlugins
1339
1336
  ## to set the proper VNIC name if using multiple adapters
1340
1337
  rename_adapter = %(netsh interface set interface name = "Ethernet" newname = "#{vnic_name}")
1341
1338
  cmd = %(netsh interface ipv4 set address name="#{vnic_name}" static #{ip} #{opts[:netmask]} #{defrouter})
1342
- dns1 = %(netsh int ipv4 set dns name="#{vnic_name}" static #{servers[0]['nameserver']} primary validate=no)
1343
- dns2 = %(netsh int ipv4 add dns name="#{vnic_name}" #{servers[1]['nameserver']} index=2 validate=no)
1339
+ dns1 = %(netsh int ipv4 set dns name="#{vnic_name}" static #{servers[0]['nameserver']} primary validate=no) unless opts[:dns].nil?
1340
+ dns2 = %(netsh int ipv4 add dns name="#{vnic_name}" #{servers[1]['nameserver']} index=2 validate=no) unless opts[:dns].nil?
1344
1341
 
1345
1342
  uii.info(I18n.t('vagrant_zones.win_applied_rename_adapter')) if zlogin(uii, rename_adapter)
1346
1343
  uii.info(I18n.t('vagrant_zones.win_applied_static')) if zlogin(uii, cmd)
@@ -1630,7 +1627,7 @@ module VagrantPlugins
1630
1627
  # name = @machine.name
1631
1628
  uii.info(I18n.t('vagrant_zones.cron_entries'))
1632
1629
  h = { h: 'hourly', d: 'daily', w: 'weekly', m: 'monthly' }
1633
- h.each do |_k, d|
1630
+ h.each do |(_k, d)|
1634
1631
  next unless opts[:list] == d || opts[:list] == 'all'
1635
1632
 
1636
1633
  uii.info(cronjobs[d.to_sym]) unless cronjobs[d.to_sym].nil?
@@ -1645,7 +1642,7 @@ module VagrantPlugins
1645
1642
  rmcr = "#{sc} -l | grep -v "
1646
1643
  h = { h: 'hourly', d: 'daily', w: 'weekly', m: 'monthly' }
1647
1644
  uii.info(I18n.t('vagrant_zones.cron_delete'))
1648
- h.each do |_k, d|
1645
+ h.each do |(_k, d)|
1649
1646
  next unless opts[:delete] == d || opts[:delete] == 'all'
1650
1647
 
1651
1648
  cj = cronjobs[d.to_sym].to_s.gsub('*', '\*')
@@ -2,7 +2,7 @@
2
2
 
3
3
  module VagrantPlugins
4
4
  module ProviderZone
5
- VERSION = '0.1.79'
5
+ VERSION = '0.1.81'
6
6
  NAME = 'vagrant-zones'
7
7
  end
8
8
  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.79
4
+ version: 0.1.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Gilbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-27 00:00:00.000000000 Z
11
+ date: 2023-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n