Skip to content

Commit

Permalink
fix: update each loops per rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkProminic committed Dec 12, 2023
1 parent ac71703 commit 646c8d3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/vagrant-zones/command/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def help
# Add the available subcommands as separators in order to print them
# out as well.
keys = []
@subcommands.each { |key, _value| keys << key.to_s }
@subcommands.each_key { |key| keys << key.to_s }
keys.sort.each do |key|
subopts.separator " #{key}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-zones/command/guest_power_controls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def help
# Add the available subcommands as separators in order to print them
# out as well.
keys = []
@subcommands.each { |key, _value| keys << key.to_s }
@subcommands.each_key { |key| keys << key.to_s }
keys.sort.each do |key|
subopts.separator " #{key}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-zones/command/zfssnapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def help
# Add the available subcommands as separators in order to print them
# out as well.
keys = []
@subcommands.each { |key, _value| keys << key.to_s }
@subcommands.each_key { |key| keys << key.to_s }
keys.sort.each do |key|
subopts.separator " #{key}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-zones/command/zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def help
# Add the available subcommands as separators in order to print them
# out as well.
keys = []
@subcommands.each { |key, _value| keys << key.to_s }
@subcommands.each_key { |key| keys << key.to_s }

keys.sort.each do |key|
subopts.separator " #{key}"
Expand Down
7 changes: 3 additions & 4 deletions lib/vagrant-zones/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def get_ip_address(_uii)
alcheck = 'login:' if config.alcheck.nil?
pcheck = 'Password:'

@machine.config.vm.networks.each do |_adaptertype, opts|
@machine.config.vm.networks.each_value do |opts|
ip = nil
if opts[:dhcp4] && opts[:managed]
vnic_name = "vnic#{nictype(opts)}#{vtype(config)}_#{config.partition_id}_#{opts[:nic_number]}"
Expand Down Expand Up @@ -526,7 +526,6 @@ 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?
netplan = netplan1 + netplan2 + netplan3 + netplan4
Expand Down Expand Up @@ -1629,7 +1628,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 do |_k, d|
h.each_value do |d|
next unless opts[:list] == d || opts[:list] == 'all'

uii.info(cronjobs[d.to_sym]) unless cronjobs[d.to_sym].nil?
Expand All @@ -1644,7 +1643,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 do |_k, d|
h.each_value do |d|
next unless opts[:delete] == d || opts[:delete] == 'all'

cj = cronjobs[d.to_sym].to_s.gsub('*', '\*')
Expand Down

0 comments on commit 646c8d3

Please sign in to comment.