From c4747fc896d44ce5de623bf0cde1e7778e89bfe3 Mon Sep 17 00:00:00 2001 From: Knut Anderssen Date: Thu, 31 Oct 2024 11:20:42 +0000 Subject: [PATCH] Some rubocop fixes --- src/modules/IscsiClientLib.rb | 6 +----- test/iscsi_client_lib_test.rb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/modules/IscsiClientLib.rb b/src/modules/IscsiClientLib.rb index 0b97b20..6d32053 100644 --- a/src/modules/IscsiClientLib.rb +++ b/src/modules/IscsiClientLib.rb @@ -1221,17 +1221,13 @@ def autoyastWrite ifacepar << " " unless ifacepar.empty? ifacepar << "-I " << iface.shellescape ifaces << iface - end - @ay_settings.fetch("targets", []).each do |target| next if portals.include? target["portal"] SCR.Execute( path(".target.bash"), GetAdmCmd(%(-m discovery #{ifacepar} -t st -p #{target["portal"].shellescape})) ) portals << target["portal"] - end - @ay_settings.fetch("targets", []).each do |target| log.info "login into target #{target}" loginIntoTarget(target) @currentRecord = [target["portal"], target["target"], target["iface"]] @@ -1298,7 +1294,7 @@ def InitIfaceFile files.each do |file| ls = SCR.Read(path(".target.string"), "/etc/iscsi/ifaces/#{file}").split("\n") log.info "InitIfaceFile file: #{file}\nInitIfaceFile ls: #{ls}" - ls.select! { |l| !l.start_with?(/\s*#/) } + ls.reject! { |l| l.start_with?(/\s*#/) } iface_name = ls.find { |l| l.include? "iface.iscsi_ifacename" }.to_s log.info "InitIfaceFile ls: #{iface_name}" next if iface_name.empty? diff --git a/test/iscsi_client_lib_test.rb b/test/iscsi_client_lib_test.rb index c44d7e1..aee6598 100644 --- a/test/iscsi_client_lib_test.rb +++ b/test/iscsi_client_lib_test.rb @@ -914,16 +914,16 @@ def ui_item_label(item) include_examples "returns UI items" it "includes 'default', 'all' and an entry for each offload card" do - items = subject.iface_items + items = subject.iface_items - labels = items.map { |i| ui_item_label(i) } - expect(labels).to contain_exactly( - "default (Software)", "all", "bnx2i.ab:cd:de:fa:cf:29.ipv4.0 - 192.168.100.29" - ) + labels = items.map { |i| ui_item_label(i) } + expect(labels).to contain_exactly( + "default (Software)", "all", "bnx2i.ab:cd:de:fa:cf:29.ipv4.0 - 192.168.100.29" + ) - ids = items.map { |i| ui_item_id(i) } - expect(ids).to contain_exactly("default", "all", "bnx2i.ab:cd:de:fa:cf:29.ipv4.0") - end + ids = items.map { |i| ui_item_id(i) } + expect(ids).to contain_exactly("default", "all", "bnx2i.ab:cd:de:fa:cf:29.ipv4.0") + end end context "and no iscsi iface is reported by iscsiadm " do