From 1f31eb013cceb3bf7b3f3ef5fc8dfaad74b21559 Mon Sep 17 00:00:00 2001 From: Mark Gilbert <50398495+MarkProminic@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:06:56 -0600 Subject: [PATCH] fix: rubocop falsepositive --- lib/vagrant-zones/command/console.rb | 2 +- lib/vagrant-zones/command/guest_power_controls.rb | 2 +- lib/vagrant-zones/command/zfssnapshot.rb | 2 +- lib/vagrant-zones/command/zone.rb | 2 +- lib/vagrant-zones/driver.rb | 10 ++++++---- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/vagrant-zones/command/console.rb b/lib/vagrant-zones/command/console.rb index 4572d8e..b47ee6a 100644 --- a/lib/vagrant-zones/command/console.rb +++ b/lib/vagrant-zones/command/console.rb @@ -49,7 +49,7 @@ def help # Add the available subcommands as separators in order to print them # out as well. keys = [] - @subcommands.each_key { |key| keys << key.to_s } + @subcommands.each { |(key, _value)| keys << key.to_s } keys.sort.each do |key| subopts.separator " #{key}" end diff --git a/lib/vagrant-zones/command/guest_power_controls.rb b/lib/vagrant-zones/command/guest_power_controls.rb index 701caa7..52617c8 100644 --- a/lib/vagrant-zones/command/guest_power_controls.rb +++ b/lib/vagrant-zones/command/guest_power_controls.rb @@ -43,7 +43,7 @@ def help # Add the available subcommands as separators in order to print them # out as well. keys = [] - @subcommands.each_key { |key| keys << key.to_s } + @subcommands.each { |(key, _value)| keys << key.to_s } keys.sort.each do |key| subopts.separator " #{key}" end diff --git a/lib/vagrant-zones/command/zfssnapshot.rb b/lib/vagrant-zones/command/zfssnapshot.rb index e2f3ffb..858414e 100644 --- a/lib/vagrant-zones/command/zfssnapshot.rb +++ b/lib/vagrant-zones/command/zfssnapshot.rb @@ -52,7 +52,7 @@ def help # Add the available subcommands as separators in order to print them # out as well. keys = [] - @subcommands.each_key { |key| keys << key.to_s } + @subcommands.each { |(key, _value)| keys << key.to_s } keys.sort.each do |key| subopts.separator " #{key}" end diff --git a/lib/vagrant-zones/command/zone.rb b/lib/vagrant-zones/command/zone.rb index 5bc2062..992ed6f 100644 --- a/lib/vagrant-zones/command/zone.rb +++ b/lib/vagrant-zones/command/zone.rb @@ -55,7 +55,7 @@ def help # Add the available subcommands as separators in order to print them # out as well. keys = [] - @subcommands.each_key { |key| keys << key.to_s } + @subcommands.each { |(key, _value)| keys << key.to_s } keys.sort.each do |key| subopts.separator " #{key}" diff --git a/lib/vagrant-zones/driver.rb b/lib/vagrant-zones/driver.rb index bf1237d..6b8ccb4 100644 --- a/lib/vagrant-zones/driver.rb +++ b/lib/vagrant-zones/driver.rb @@ -266,7 +266,7 @@ def get_ip_address(_uii) alcheck = 'login:' if config.alcheck.nil? pcheck = 'Password:' - @machine.config.vm.networks.each_value do |opts| + @machine.config.vm.networks.each do |(_adaptertype, opts)| ip = nil if opts[:dhcp4] && opts[:managed] vnic_name = "vnic#{nictype(opts)}#{vtype(config)}_#{config.partition_id}_#{opts[:nic_number]}" @@ -526,8 +526,9 @@ def zonenicnatsetup_netplan(uii, opts, mac) uii.info(" #{vnic_name}") netplan1 = %(network:\n version: 2\n ethernets:\n #{vnic_name}:\n match:\n macaddress: #{mac}\n) netplan2 = %( dhcp-identifier: mac\n dhcp4: #{opts[:dhcp4]}\n dhcp6: #{opts[:dhcp6]}\n) + #netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n gateway4: #{defrouter}\n) netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n routes:\n - to: default\n via: #{defrouter}\n) - netplan4 = %( nameservers:\n addresses: [#{servers}] ) unless opts[:dns].nil? + netplan4 = %( nameservers:\n addresses: [#{servers}] ) unless opts[:dns].nil? netplan = netplan1 + netplan2 + netplan3 + netplan4 cmd = "echo -e '#{netplan}' | sudo tee /etc/netplan/#{vnic_name}.yaml && chmod 400 /etc/netplan/#{vnic_name}.yaml" uii.info(I18n.t('vagrant_zones.netplan_applied_static') + "/etc/netplan/#{vnic_name}.yaml") if ssh_run_command(uii, cmd) @@ -1143,6 +1144,7 @@ def zoneniczloginsetup_netplan(uii, opts, mac) netplan2 = %( dhcp-identifier: mac\n dhcp4: #{opts[:dhcp4]}\n dhcp6: #{opts[:dhcp6]}\n) if opts[:dhcp4] netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n) netplan3 = %( set-name: #{vnic_name}\n) if opts[:dhcp4] + #netplan4 = %( gateway4: #{defrouter}\n) netplan4 = %( routes:\n - to: default\n via: #{defrouter}\n) netplan5 = %( nameservers:\n addresses: [#{servers}] ) unless opts[:dns].nil? netplan = netplan1 + netplan2 + netplan3 + netplan5 if opts[:gateway].nil? @@ -1627,7 +1629,7 @@ def zfssnapcronlist(uii, disk, opts, cronjobs) # name = @machine.name uii.info(I18n.t('vagrant_zones.cron_entries')) h = { h: 'hourly', d: 'daily', w: 'weekly', m: 'monthly' } - h.each_value do |d| + h.each do |(_k, d)| next unless opts[:list] == d || opts[:list] == 'all' uii.info(cronjobs[d.to_sym]) unless cronjobs[d.to_sym].nil? @@ -1642,7 +1644,7 @@ def zfssnapcrondelete(uii, disk, opts, cronjobs) rmcr = "#{sc} -l | grep -v " h = { h: 'hourly', d: 'daily', w: 'weekly', m: 'monthly' } uii.info(I18n.t('vagrant_zones.cron_delete')) - h.each_value do |d| + h.each do |(_k, d)| next unless opts[:delete] == d || opts[:delete] == 'all' cj = cronjobs[d.to_sym].to_s.gsub('*', '\*')