Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-iscsi-client for 
openSUSE:Factory checked in at 2022-10-10 18:44:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-iscsi-client (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-iscsi-client.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-iscsi-client"

Mon Oct 10 18:44:25 2022 rev:140 rq:1008350 version:4.5.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-iscsi-client/yast2-iscsi-client.changes    
2022-06-23 10:22:30.071624643 +0200
+++ 
/work/SRC/openSUSE:Factory/.yast2-iscsi-client.new.2275/yast2-iscsi-client.changes
  2022-10-10 18:45:05.650937313 +0200
@@ -1,0 +2,10 @@
+Wed Oct  5 10:09:58 UTC 2022 - Josef Reidinger <[email protected]>
+
+- replace .process agent with running Execute to respect changed
+  root (bsc#1128853)
+- drop spec dependencies on open-iscsi and iscsiuio as it is needed
+  only on target system. This allows container size reduction
+  (bsc#1128853)
+- 4.5.5
+
+-------------------------------------------------------------------

Old:
----
  yast2-iscsi-client-4.5.4.tar.bz2

New:
----
  yast2-iscsi-client-4.5.5.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-iscsi-client.spec ++++++
--- /var/tmp/diff_new_pack.6cOpSz/_old  2022-10-10 18:45:06.114938311 +0200
+++ /var/tmp/diff_new_pack.6cOpSz/_new  2022-10-10 18:45:06.118938320 +0200
@@ -17,25 +17,23 @@
 
 
 Name:           yast2-iscsi-client
-Version:        4.5.4
+Version:        4.5.5
 Release:        0
 Summary:        YaST2 - iSCSI Client Configuration
 License:        GPL-2.0-only
 Group:          System/YaST
 URL:            https://github.com/yast/yast-iscsi-client
 Source0:        %{name}-%{version}.tar.bz2
-# Yast2::Systemd::Socket
-BuildRequires:  docbook-xsl-stylesheets
-BuildRequires:  libxslt
 BuildRequires:  update-desktop-files
-BuildRequires:  yast2 >= 2.23.15
+# Yast2::Systemd::Socket
 BuildRequires:  yast2 >= 4.1.3
+# needed for test of finish client which include installation/misc
 BuildRequires:  yast2-devtools >= 4.4.0
+BuildRequires:  yast2-installation
 BuildRequires:  yast2-packager
+BuildRequires:  rubygem(%rb_default_ruby_abi:yast-rake)
 BuildRequires:  rubygem(%{rb_default_ruby_abi}:rspec)
 # Yast2::Systemd::Socket
-Requires:       iscsiuio
-Requires:       open-iscsi
 Requires:       yast2 >= 4.1.3
 Requires:       yast2-packager
 Requires:       yast2-ruby-bindings >= 3.1.7
@@ -49,8 +47,10 @@
 %prep
 %setup -q
 
+%check
+%yast_check
+
 %build
-%yast_build
 
 %install
 %yast_install
@@ -58,6 +58,7 @@
 
 %files
 %license COPYING
+%doc %{yast_docdir}
 %{yast_yncludedir}
 %{yast_clientdir}
 %{yast_moduledir}
@@ -66,5 +67,6 @@
 %{yast_scrconfdir}
 %{yast_schemadir}
 %{yast_icondir}
+%{yast_libdir}
 
 %changelog

++++++ yast2-iscsi-client-4.5.4.tar.bz2 -> yast2-iscsi-client-4.5.5.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/.rubocop.yml 
new/yast2-iscsi-client-4.5.5/.rubocop.yml
--- old/yast2-iscsi-client-4.5.4/.rubocop.yml   2022-06-21 16:04:53.000000000 
+0200
+++ new/yast2-iscsi-client-4.5.5/.rubocop.yml   2022-10-06 10:27:42.000000000 
+0200
@@ -100,7 +100,7 @@
 # Offense count: 1
 # Configuration parameters: CountComments, CountAsOne.
 Metrics/ClassLength:
-  Max: 1282
+  Max: 1283
 
 # Offense count: 21
 # Configuration parameters: IgnoredMethods.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/Makefile.cvs 
new/yast2-iscsi-client-4.5.5/Makefile.cvs
--- old/yast2-iscsi-client-4.5.4/Makefile.cvs   2022-06-21 16:04:53.000000000 
+0200
+++ new/yast2-iscsi-client-4.5.5/Makefile.cvs   1970-01-01 01:00:00.000000000 
+0100
@@ -1,22 +0,0 @@
-#
-# Makefile.cvs
-#
-PREFIX = /usr
-
-LIB = $(shell y2tool get-lib)
-
-configure: all
-       ./configure --prefix=$(PREFIX) --libdir=$(PREFIX)/$(LIB)
-
-all:
-       y2tool y2autoconf
-       y2tool y2automake
-       autoreconf --force --install
-
-install: configure
-       make
-       make install
-
-reconf: all
-       ./config.status --recheck
-       ./config.status
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/agents/Makefile.am 
new/yast2-iscsi-client-4.5.5/agents/Makefile.am
--- old/yast2-iscsi-client-4.5.4/agents/Makefile.am     2022-06-21 
16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/agents/Makefile.am     1970-01-01 
01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-# Makefile.am for iscsi-client/agents
-
-agent_SCRIPTS =
-
-scrconf_DATA = iscsid.scr
-
-EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/agents/iscsid.scr 
new/yast2-iscsi-client-4.5.5/agents/iscsid.scr
--- old/yast2-iscsi-client-4.5.4/agents/iscsid.scr      2022-06-21 
16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/agents/iscsid.scr      1970-01-01 
01:00:00.000000000 +0100
@@ -1,48 +0,0 @@
-/*
- *   Read(.ietd.Compression)
- *   (["yes"])
- *
- *   Write(.ietd.Compression, "no")
- *   (true)
- *
- * Fore more information about possible keys and values
- * consult with the slp_config man pages `man slp_config`.
- */
-
-.etc.iscsid
-
-`ag_ini(
-    `IniAgent( "/etc/iscsi/iscsid.conf",
-        $[
-        "options" : [ "global_values", "comments_last", "line_can_continue", 
"join_multiline", "repeat_names" ],
-        "comments": [
-            "^[ \t]*$", // empty line
-            "^[ \t]+[;#].*$", // comment char is not first char
-            "^[#][ \t]*$", // only comment chars
-            "^[#][ \t]*\\[[^]]*$", // comment chars followed by '[' without 
matching ']'
-            "^[#][^ \t[]", // comment char followed by non-blank nor '['
-            "^[#][ \t]+[^[a-z \t].*$", // comment chars followed by non a-z 
char nor '[' nor blank
-            "^[#][ \t]+[a-z ]*[a-z][ \t]*$", // comment chars followed by a-z 
or blank chars
-            "^[#][ \t]+[a-z ]*[a-z][ \t]*[^a-z \t=].*$", // like above, but 
followed by non a-z nor blank nor '=' chars
-        ],
-        "sections" : [
-            $[
-                "begin" : [ "^[ \t]*\\[[ \t]*(.*[^ \t])[ \t]*\\][ \t]*", 
"[%s]" ],
-            ], $[
-                // this is a special type for commenting out the values
-                "begin" : [ "^[#;][ \t]*\\[[ \t]*(.*[^ \t])[ \t]*\\][ \t]*", 
"# [%s]" ],
-            ]
-        ],
-
-        // we need to exclude ; because of the second matching rule
-        "params" : [
-                // Options with one value ('yes' / 'no')
-//                $[ "match" : [ "^[#;][ \t]*([^ \t]+)[ \t]+([^ \t]+)[ \t]+$", 
"%s %s" ]],
-                $[ "match" : [ "^[#;][ \t]*([^ \t\=]+)[ \t\=]?(.+)[ \t]*$", "; 
%s %s" ]],
-                // Options with more possible values
-                $[ "match" : [ "^[ \t]*([^ \t\=]+)[ \t\=]+[ ]*(.+)[ \t]*$", 
"%s = %s" ]],
-        ],
-       ]
-    )
-)
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/configure.in.in 
new/yast2-iscsi-client-4.5.5/configure.in.in
--- old/yast2-iscsi-client-4.5.4/configure.in.in        2022-06-21 
16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/configure.in.in        1970-01-01 
01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-## YCP module configure.in.in
-
-## Initialize
-@YAST2-INIT-COMMON@
-@YAST2-INIT-YCP@
-
-## some common checks
-@YAST2-CHECKS-COMMON@
-@YAST2-CHECKS-YCP@
-
-## and generate the output...
-@YAST2-OUTPUT@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-iscsi-client-4.5.4/package/yast2-iscsi-client.changes 
new/yast2-iscsi-client-4.5.5/package/yast2-iscsi-client.changes
--- old/yast2-iscsi-client-4.5.4/package/yast2-iscsi-client.changes     
2022-06-21 16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/package/yast2-iscsi-client.changes     
2022-10-06 10:27:42.000000000 +0200
@@ -1,4 +1,14 @@
 -------------------------------------------------------------------
+Wed Oct  5 10:09:58 UTC 2022 - Josef Reidinger <[email protected]>
+
+- replace .process agent with running Execute to respect changed
+  root (bsc#1128853)
+- drop spec dependencies on open-iscsi and iscsiuio as it is needed
+  only on target system. This allows container size reduction
+  (bsc#1128853)
+- 4.5.5
+
+-------------------------------------------------------------------
 Tue Jun 21 13:19:31 UTC 2022 - Ancor Gonzalez Sosa <[email protected]>
 
 - Stop using the deprecated agent "background".
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-iscsi-client-4.5.4/package/yast2-iscsi-client.spec 
new/yast2-iscsi-client-4.5.5/package/yast2-iscsi-client.spec
--- old/yast2-iscsi-client-4.5.4/package/yast2-iscsi-client.spec        
2022-06-21 16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/package/yast2-iscsi-client.spec        
2022-10-06 10:27:42.000000000 +0200
@@ -17,25 +17,23 @@
 
 
 Name:           yast2-iscsi-client
-Version:        4.5.4
+Version:        4.5.5
 Release:        0
 Summary:        YaST2 - iSCSI Client Configuration
 License:        GPL-2.0-only
 Group:          System/YaST
 URL:            https://github.com/yast/yast-iscsi-client
 Source0:        %{name}-%{version}.tar.bz2
-# Yast2::Systemd::Socket
-BuildRequires:  docbook-xsl-stylesheets
-BuildRequires:  libxslt
 BuildRequires:  update-desktop-files
-BuildRequires:  yast2 >= 2.23.15
+# Yast2::Systemd::Socket
 BuildRequires:  yast2 >= 4.1.3
+# needed for test of finish client which include installation/misc
+BuildRequires:  yast2-installation
 BuildRequires:  yast2-devtools >= 4.4.0
 BuildRequires:  yast2-packager
 BuildRequires:  rubygem(%{rb_default_ruby_abi}:rspec)
+BuildRequires:  rubygem(%rb_default_ruby_abi:yast-rake)
 # Yast2::Systemd::Socket
-Requires:       iscsiuio
-Requires:       open-iscsi
 Requires:       yast2 >= 4.1.3
 Requires:       yast2-packager
 Requires:       yast2-ruby-bindings >= 3.1.7
@@ -49,8 +47,10 @@
 %prep
 %setup -q
 
+%check
+%yast_check
+
 %build
-%yast_build
 
 %install
 %yast_install
@@ -58,6 +58,7 @@
 
 %files
 %license COPYING
+%doc %{yast_docdir}
 %{yast_yncludedir}
 %{yast_clientdir}
 %{yast_moduledir}
@@ -66,5 +67,6 @@
 %{yast_scrconfdir}
 %{yast_schemadir}
 %{yast_icondir}
+%{yast_libdir}
 
 %changelog
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/src/Makefile.am 
new/yast2-iscsi-client-4.5.5/src/Makefile.am
--- old/yast2-iscsi-client-4.5.4/src/Makefile.am        2022-06-21 
16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/src/Makefile.am        1970-01-01 
01:00:00.000000000 +0100
@@ -1,38 +0,0 @@
-# Sources for iscsi-client
-
-module_DATA = \
-  modules/IscsiClientLib.rb \
-  modules/IscsiClient.rb
-
-client_DATA = \
-  clients/iscsi-client.rb \
-  clients/iscsi-client_auto.rb \
-  clients/iscsi-client_proposal.rb \
-  clients/iscsi-client_finish.rb \
-  clients/inst_iscsi-client.rb
-
-yncludedir = @yncludedir@/iscsi-client
-ynclude_DATA = \
-  include/iscsi-client/widgets.rb \
-  include/iscsi-client/wizards.rb \
-  include/iscsi-client/dialogs.rb \
-  include/iscsi-client/complex.rb \
-  include/iscsi-client/helps.rb
-
-schemafilesdir = $(schemadir)/autoyast/rnc
-schemafiles_DATA = \
-  autoyast-rnc/iscsi-client.rnc
-
-desktop_DATA = \
-  desktop/org.opensuse.yast.iSCSIClient.desktop
-
-symbolicdir = @icondir@/hicolor/symbolic/apps
-symbolic_DATA = \
-  icons/hicolor/symbolic/apps/yast-iscsi-client-symbolic.svg
-scalabledir = @icondir@/hicolor/scalable/apps
-scalable_DATA = \
-  icons/hicolor/scalable/apps/yast-iscsi-client.svg
-
-EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(schemafiles_DATA) 
$(desktop_DATA) $(symbolic_DATA) $(scalable_DATA)
-
-include $(top_srcdir)/Makefile.am.common
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-iscsi-client-4.5.4/src/include/iscsi-client/dialogs.rb 
new/yast2-iscsi-client-4.5.5/src/include/iscsi-client/dialogs.rb
--- old/yast2-iscsi-client-4.5.4/src/include/iscsi-client/dialogs.rb    
2022-06-21 16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/src/include/iscsi-client/dialogs.rb    
2022-10-06 10:27:42.000000000 +0200
@@ -51,8 +51,10 @@
 
       Yast.include include_target, "iscsi-client/helps.rb"
       Yast.include include_target, "iscsi-client/widgets.rb"
+    end
 
-      @widgets = {
+    def widgets
+      @widgets ||= {
         "auto_start_up"    => service_widget.cwm_definition,
         "isns"             => {
           "widget"            => :custom,
@@ -304,8 +306,10 @@
           "help"          => Ops.get_string(@HELPS, "ibft_table", "")
         }
       }
+    end
 
-      @tabs_descr = {
+    def tabs_descr
+      @tabs_descr ||= {
         # service status dialog
         "general"    => {
           "header"       => _("Service"),
@@ -368,7 +372,7 @@
     # main tabbed dialog
     def GlobalDialog
       if Stage.initial
-        Ops.set(@tabs_descr, ["general", "widget_names"], ["initiator_name"])
+        Ops.set(tabs_descr, ["general", "widget_names"], ["initiator_name"])
       end
       caption = _("iSCSI Initiator Overview")
 
@@ -381,8 +385,8 @@
       widget_descr = {
         "tab" => CWMTab.CreateWidget(
           "tab_order"    => tab_order,
-          "tabs"         => @tabs_descr,
-          "widget_descr" => @widgets,
+          "tabs"         => tabs_descr,
+          "widget_descr" => widgets,
           "initial_tab"  => Stage.initial ? "general" : @current_tab,
           "tab_help"     => _("<h1>iSCSI Initiator</h1>")
         )
@@ -419,7 +423,7 @@
     def DiscAuthDialog(return_to)
       @current_tab = return_to
       caption = _("iSCSI Initiator Discovery") # bug #148963 _("iSCSI Target 
Login");
-      w = CWM.CreateWidgets(["server_location", "discovery_auth"], @widgets)
+      w = CWM.CreateWidgets(["server_location", "discovery_auth"], widgets)
       contents = VBox(
         VStretch(),
         HBox(
@@ -457,7 +461,7 @@
     def TargetsDialog
       @current_tab = "client"
       caption = _("iSCSI Initiator Discovery")
-      w = CWM.CreateWidgets(["targets_table"], @widgets)
+      w = CWM.CreateWidgets(["targets_table"], widgets)
       contents = VBox(
         HBox(HSpacing(1), VBox(Ops.get_term(w, [0, "widget"]) { VSpacing(1) 
}), HSpacing(
                                                                                
   1
@@ -482,7 +486,7 @@
     def ConnAuthDialog(return_to)
       @current_tab = return_to
       caption = _("iSCSI Initiator Discovery")
-      w = CWM.CreateWidgets(["startup", "conn_auth"], @widgets)
+      w = CWM.CreateWidgets(["startup", "conn_auth"], widgets)
 
       contents = VBox(
         VStretch(),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-iscsi-client-4.5.4/src/include/iscsi-client/widgets.rb 
new/yast2-iscsi-client-4.5.5/src/include/iscsi-client/widgets.rb
--- old/yast2-iscsi-client-4.5.4/src/include/iscsi-client/widgets.rb    
2022-06-21 16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/src/include/iscsi-client/widgets.rb    
2022-10-06 10:27:42.000000000 +0200
@@ -29,6 +29,7 @@
 # Main file for iscsi-client configuration. Uses all other files.
 
 require "shellwords"
+require "y2iscsi_client/timeout_process"
 
 module Yast
   module IscsiClientWidgetsInclude
@@ -36,66 +37,6 @@
       textdomain "iscsi-client"
       Yast.import "IP"
       Yast.import "Arch"
-
-      @stat = false
-      @curr_rec = []
-      @bg_finish = false
-    end
-
-    # Runs the given command in background with a timeout of 10 seconds
-    #
-    # The method sets @bg_finish to true and returns the stdout of the command.
-    # Additionally:
-    #
-    # - If the command success, the method sets @stat to true.
-    # - If the command fails, the method displays the first line of stderr to 
the user
-    #   and sets @stat to false.
-    # - It the timeout is reached, the process is killed and the method 
displays a
-    #   message about the timeout to the user. The value of @stat is not 
modified.
-    #
-    # @return [Array<String>] each one of the lines of stdout
-    def runInBg(command)
-      @bg_finish = false
-      Builtins.y2milestone("Start command %1 in background", command)
-      stdout = []
-      return_code = nil
-
-      pid = SCR.Execute(path(".process.start_shell"), command)
-      time_spent = 0
-      cont_loop = true
-      script_time_out = 10000
-      sleep_step = 20
-
-      while cont_loop && SCR.Read(path(".process.running"), pid)
-        if time_spent >= script_time_out
-          Popup.Error(_("Command timed out"))
-          cont_loop = false
-        end
-        time_spent += sleep_step
-        Builtins.sleep(sleep_step)
-      end
-
-      Builtins.y2milestone("Time spent: %1 msec", time_spent)
-      stdout = (SCR.Read(path(".process.read"), pid) || "").split("\n")
-      Builtins.y2milestone("Output: %1", stdout)
-
-      if cont_loop
-        return_code = SCR.Read(path(".process.status"), pid).to_i
-        Builtins.y2milestone("Return: %1", return_code)
-        if return_code != 0
-          @stat = false
-          error = SCR.Read(path(".process.read_line_stderr"), pid)
-          Builtins.y2error("Error: %1", error)
-          Popup.Error(error)
-        else
-          @stat = true
-        end
-      else
-        # killing the process if it still runs
-        SCR.Execute(path(".process.kill"), pid)
-      end
-      @bg_finish = true
-      deep_copy(stdout)
     end
 
     # validation for authentication dialog entry
@@ -623,8 +564,6 @@
       # temporarily write authentication data to /etc/iscsi/iscsi.conf
       IscsiClientLib.saveConfig(user_in, pass_in, user_out, pass_out)
 
-      @bg_finish = false
-
       # Check @current_tab (dialogs.rb) here. If it's "client", i.e. the
       # 'Add' button at 'Connected Targets' is used, create discovery
       # command with option --new. The start-up mode for already connected
@@ -640,24 +579,19 @@
       command = IscsiClientLib.GetDiscoveryCmd(ip, port,
         use_fw:   false,
         only_new: option_new)
-      trg_list = runInBg(command)
-      until @bg_finish
-
-      end
-      if Builtins.size(trg_list) == 0
+      success, trg_list = Y2IscsiClient::TimeoutProcess.run(command)
+      if trg_list.empty?
         command = IscsiClientLib.GetDiscoveryCmd(ip, port,
           use_fw:   true,
           only_new: option_new)
-        trg_list = runInBg(command)
-        until @bg_finish
-
-        end
+        success, trg_list = Y2IscsiClient::TimeoutProcess.run(command)
       end
+
       IscsiClientLib.targets = IscsiClientLib.ScanDiscovered(trg_list)
       # restore saved config
       IscsiClientLib.oldConfig
 
-      @stat
+      success
     end
 
     # ********************* discovered table *******************
@@ -734,7 +668,6 @@
         Ops.get(params, 1, ""),
         Ops.get(params, 2, "default")
       ]
-      #    params = curr_rec;
       if Ops.get_string(event, "EventReason", "") == "Activated"
         # connect new target
         if Ops.get(event, "ID") == :connect
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-iscsi-client-4.5.4/src/lib/y2iscsi_client/timeout_process.rb 
new/yast2-iscsi-client-4.5.5/src/lib/y2iscsi_client/timeout_process.rb
--- old/yast2-iscsi-client-4.5.4/src/lib/y2iscsi_client/timeout_process.rb      
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-iscsi-client-4.5.5/src/lib/y2iscsi_client/timeout_process.rb      
2022-10-06 10:27:42.000000000 +0200
@@ -0,0 +1,39 @@
+require "yast"
+require "yast2/execute"
+
+Yast.import "Popup"
+
+# yast2 iscsi client specific namespace
+module Y2IscsiClient
+  # Runner class that execute command with given timeout
+  module TimeoutProcess
+    include Yast::I18n
+    extend Yast::I18n
+
+    # @param [Array<String>] command as list of arguments
+    # @param [Integer] seconds timeout for command
+    # @return [Array(Boolean, Array<String>)] return pair of boolean if command
+    #   succeed and stdout lines without ending newline
+    def self.run(command, seconds: 10)
+      textdomain "iscsi-client"
+
+      # pass kill-after to ensure that command really dies even if ignore TERM
+      stdout, stderr, exit_status = Yast::Execute.on_target!(
+        "/usr/bin/timeout", "--kill-after=5s", "#{seconds}s",
+        *command, stdout: :capture, stderr: :capture,
+        allowed_exitstatus: 0..255, env: { "LC_ALL" => "POSIX" }
+      )
+
+      output = stdout.split("\n")
+      case exit_status
+      when 0 then [true, output]
+      when 124, (128 + 9)
+        Yast::Popup.Error(_("Command timed out"))
+        [false, output]
+      else
+        Yast::Popup.Error(stderr)
+        [false, output]
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-iscsi-client-4.5.4/src/modules/IscsiClientLib.rb 
new/yast2-iscsi-client-4.5.5/src/modules/IscsiClientLib.rb
--- old/yast2-iscsi-client-4.5.4/src/modules/IscsiClientLib.rb  2022-06-21 
16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/src/modules/IscsiClientLib.rb  2022-10-06 
10:27:42.000000000 +0200
@@ -1496,25 +1496,28 @@
       nil
     end
 
+    # @return [Array<String>]
     def GetDiscoveryCmd(ip, port, use_fw: false, only_new: false)
       Builtins.y2milestone("GetDiscoveryCmd ip:%1 port:%2 fw:%3 only new:%4",
         ip, port, use_fw, only_new)
-      command = "-m discovery -P 1"
+      command = ["/usr/sbin/iscsiadm", "-m", "discovery", "-P", "1"]
       isns_info = useISNS
       if isns_info["use"]
-        command << " -t isns -p #{ip}:#{port}"
+        command << "-t" << "isns"
       else
         ifs = GetDiscIfaces()
         Builtins.y2milestone("ifs=%1", ifs)
-        ifs = Builtins.maplist(ifs) { |s| Ops.add("-I ", s) }
+        ifs = ifs.each_with_object([]) { |s, res| res << "-I" << s }
         Builtins.y2milestone("ifs=%1", ifs)
         tgt = "st"
         tgt = "fw" if use_fw
-        command << " -t #{tgt} #{ifs.join(" ")} -p #{ip}:#{port}"
+        command << "-t" << tgt
+        command.concat(ifs)
       end
-      command << " -o new" if only_new
 
-      command = GetAdmCmd(command)
+      command << "-p" << "#{ip}:#{port}"
+      command << "-o" << "new" if only_new
+
       Builtins.y2milestone("GetDiscoveryCmd %1", command)
       command
     end
@@ -1574,7 +1577,6 @@
     publish :function => :GetOffloadItems, :type => "list <term> ()"
     publish :function => :GetOffloadModules, :type => "list <string> ()"
     publish :function => :LoadOffloadModules, :type => "list <string> ()"
-    publish :function => :GetDiscoveryCmd, :type => "string (string, string, 
map)"
     publish :function => :getCurrentNodeValues, :type => "map <string, any> ()"
     publish :function => :iBFT?, :type => "boolean (map <string, any>)"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/src/scrconf/iscsid.scr 
new/yast2-iscsi-client-4.5.5/src/scrconf/iscsid.scr
--- old/yast2-iscsi-client-4.5.4/src/scrconf/iscsid.scr 1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-iscsi-client-4.5.5/src/scrconf/iscsid.scr 2022-10-06 
10:27:42.000000000 +0200
@@ -0,0 +1,48 @@
+/*
+ *   Read(.ietd.Compression)
+ *   (["yes"])
+ *
+ *   Write(.ietd.Compression, "no")
+ *   (true)
+ *
+ * Fore more information about possible keys and values
+ * consult with the slp_config man pages `man slp_config`.
+ */
+
+.etc.iscsid
+
+`ag_ini(
+    `IniAgent( "/etc/iscsi/iscsid.conf",
+        $[
+        "options" : [ "global_values", "comments_last", "line_can_continue", 
"join_multiline", "repeat_names" ],
+        "comments": [
+            "^[ \t]*$", // empty line
+            "^[ \t]+[;#].*$", // comment char is not first char
+            "^[#][ \t]*$", // only comment chars
+            "^[#][ \t]*\\[[^]]*$", // comment chars followed by '[' without 
matching ']'
+            "^[#][^ \t[]", // comment char followed by non-blank nor '['
+            "^[#][ \t]+[^[a-z \t].*$", // comment chars followed by non a-z 
char nor '[' nor blank
+            "^[#][ \t]+[a-z ]*[a-z][ \t]*$", // comment chars followed by a-z 
or blank chars
+            "^[#][ \t]+[a-z ]*[a-z][ \t]*[^a-z \t=].*$", // like above, but 
followed by non a-z nor blank nor '=' chars
+        ],
+        "sections" : [
+            $[
+                "begin" : [ "^[ \t]*\\[[ \t]*(.*[^ \t])[ \t]*\\][ \t]*", 
"[%s]" ],
+            ], $[
+                // this is a special type for commenting out the values
+                "begin" : [ "^[#;][ \t]*\\[[ \t]*(.*[^ \t])[ \t]*\\][ \t]*", 
"# [%s]" ],
+            ]
+        ],
+
+        // we need to exclude ; because of the second matching rule
+        "params" : [
+                // Options with one value ('yes' / 'no')
+//                $[ "match" : [ "^[#;][ \t]*([^ \t]+)[ \t]+([^ \t]+)[ \t]+$", 
"%s %s" ]],
+                $[ "match" : [ "^[#;][ \t]*([^ \t\=]+)[ \t\=]?(.+)[ \t]*$", "; 
%s %s" ]],
+                // Options with more possible values
+                $[ "match" : [ "^[ \t]*([^ \t\=]+)[ \t\=]+[ ]*(.+)[ \t]*$", 
"%s = %s" ]],
+        ],
+       ]
+    )
+)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-iscsi-client-4.5.4/test/Makefile.am 
new/yast2-iscsi-client-4.5.5/test/Makefile.am
--- old/yast2-iscsi-client-4.5.4/test/Makefile.am       2022-06-21 
16:04:53.000000000 +0200
+++ new/yast2-iscsi-client-4.5.5/test/Makefile.am       1970-01-01 
01:00:00.000000000 +0100
@@ -1,8 +0,0 @@
-TESTS = \
-  iscsi_client_lib_test.rb       \
-  iscsi_client_test.rb
-
-TEST_EXTENSIONS = .rb
-RB_LOG_COMPILER = rspec
-VERBOSE = 1
-EXTRA_DIST = $(TESTS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-iscsi-client-4.5.4/test/y2iscsi_client/timeout_process_test.rb 
new/yast2-iscsi-client-4.5.5/test/y2iscsi_client/timeout_process_test.rb
--- old/yast2-iscsi-client-4.5.4/test/y2iscsi_client/timeout_process_test.rb    
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-iscsi-client-4.5.5/test/y2iscsi_client/timeout_process_test.rb    
2022-10-06 10:27:42.000000000 +0200
@@ -0,0 +1,47 @@
+#!/usr/bin/env rspec
+
+require_relative "../test_helper"
+require "y2iscsi_client/timeout_process"
+
+describe Y2IscsiClient::TimeoutProcess do
+  describe ".run" do
+    before do
+      allow(Yast::Popup).to receive(:Error)
+    end
+
+    context "when command succeed" do
+      it "returns true and its stdout" do
+        expect(described_class.run(["echo", "15\n50"])).to eq([true, ["15", 
"50"]])
+      end
+    end
+
+    context "when command failed" do
+      # a command that produces stdout AND stderr AND fails
+      let(:command) { ["sh", "-c", "echo Copying data; echo >&2 Giving up; 
false"] }
+      it "shows error popup with its stderr" do
+        expect(Yast::Popup).to receive(:Error).with("Giving up\n")
+
+        described_class.run(command)
+      end
+
+      it "returns false and its stdout" do
+        expect(described_class.run(command)).to eq([false, ["Copying data"]])
+      end
+    end
+
+    context "when command runs after timeout" do
+      # a command that produces stdout AND stderr AND takes a long time
+      let(:command) { ["sh", "-c", "echo Copying data; echo >&2 Mars is too 
far; sleep 999"] }
+
+      it "shows generic error popup" do
+        expect(Yast::Popup).to receive(:Error).with("Command timed out")
+
+        described_class.run(command, seconds: 1)
+      end
+
+      it "returns false and its stdout" do
+        expect(described_class.run(command, seconds: 1)).to eq([false, 
["Copying data"]])
+      end
+    end
+  end
+end

Reply via email to