Hello community,

here is the log from the commit of package autoyast2 for openSUSE:Factory 
checked in at 2018-09-04 22:50:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/autoyast2 (Old)
 and      /work/SRC/openSUSE:Factory/.autoyast2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "autoyast2"

Tue Sep  4 22:50:01 2018 rev:247 rq:630847 version:4.0.60

Changes:
--------
--- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes      2018-07-03 
23:32:02.120608362 +0200
+++ /work/SRC/openSUSE:Factory/.autoyast2.new/autoyast2.changes 2018-09-04 
22:50:04.727749053 +0200
@@ -1,0 +2,26 @@
+Tue Aug 21 08:01:33 UTC 2018 - [email protected]
+
+- AutoInstallRules: increased default maxdepth for not crashing
+  with a big software package list (bsc#1104655)
+- 4.0.60
+
+-------------------------------------------------------------------
+Mon Aug 20 15:15:39 CEST 2018 - [email protected]
+
+- Switched license in spec file from SPDX2 to SPDX3 format.
+
+-------------------------------------------------------------------
+Fri Aug 17 09:46:05 CEST 2018 - [email protected]
+
+- Installation/Update: Do not call registration if module
+  yast2-registraion is not available in inst-sys (bsc#1098794).
+- 4.0.59
+
+-------------------------------------------------------------------
+Tue Aug 14 09:47:25 CEST 2018 - [email protected]
+
+- AY configuration module: Report XML errors while reading an
+  AY configuration file (bsc#1098794)
+- 4.0.58
+
+-------------------------------------------------------------------

Old:
----
  autoyast2-4.0.57.tar.bz2

New:
----
  autoyast2-4.0.60.tar.bz2

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

Other differences:
------------------
++++++ autoyast2.spec ++++++
--- /var/tmp/diff_new_pack.oG4h2j/_old  2018-09-04 22:50:05.879753010 +0200
+++ /var/tmp/diff_new_pack.oG4h2j/_new  2018-09-04 22:50:05.879753010 +0200
@@ -22,7 +22,7 @@
 %endif
 
 Name:           autoyast2
-Version:        4.0.57
+Version:        4.0.60
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -85,7 +85,7 @@
 Requires:       yast2-ruby-bindings >= 1.0.0
 
 Summary:        YaST2 - Automated Installation
-License:        GPL-2.0
+License:        GPL-2.0-only
 Group:          System/YaST
 
 %description

++++++ autoyast2-4.0.57.tar.bz2 -> autoyast2-4.0.60.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/package/autoyast2.changes 
new/autoyast2-4.0.60/package/autoyast2.changes
--- old/autoyast2-4.0.57/package/autoyast2.changes      2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/package/autoyast2.changes      2018-08-22 
10:08:42.000000000 +0200
@@ -1,4 +1,30 @@
 -------------------------------------------------------------------
+Tue Aug 21 08:01:33 UTC 2018 - [email protected]
+
+- AutoInstallRules: increased default maxdepth for not crashing
+  with a big software package list (bsc#1104655)
+- 4.0.60
+
+-------------------------------------------------------------------
+Mon Aug 20 15:15:39 CEST 2018 - [email protected]
+
+- Switched license in spec file from SPDX2 to SPDX3 format.
+
+-------------------------------------------------------------------
+Fri Aug 17 09:46:05 CEST 2018 - [email protected]
+
+- Installation/Update: Do not call registration if module
+  yast2-registraion is not available in inst-sys (bsc#1098794).
+- 4.0.59
+
+-------------------------------------------------------------------
+Tue Aug 14 09:47:25 CEST 2018 - [email protected]
+
+- AY configuration module: Report XML errors while reading an
+  AY configuration file (bsc#1098794)
+- 4.0.58
+
+-------------------------------------------------------------------
 Thu Jun 28 14:29:25 CEST 2018 - [email protected]
 
 - Added additional searchkeys to desktop file (fate#321043).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/package/autoyast2.spec 
new/autoyast2-4.0.60/package/autoyast2.spec
--- old/autoyast2-4.0.57/package/autoyast2.spec 2018-07-02 16:32:34.000000000 
+0200
+++ new/autoyast2-4.0.60/package/autoyast2.spec 2018-08-22 10:08:42.000000000 
+0200
@@ -22,7 +22,7 @@
 %endif
 
 Name:           autoyast2
-Version:        4.0.57
+Version:        4.0.60
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -85,7 +85,7 @@
 Requires:       yast2-ruby-bindings >= 1.0.0
 
 Summary:        YaST2 - Automated Installation
-License:        GPL-2.0
+License:        GPL-2.0-only
 Group:          System/YaST
 
 %description
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/src/clients/inst_autosetup.rb 
new/autoyast2-4.0.60/src/clients/inst_autosetup.rb
--- old/autoyast2-4.0.57/src/clients/inst_autosetup.rb  2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/src/clients/inst_autosetup.rb  2018-08-22 
10:08:42.000000000 +0200
@@ -336,22 +336,8 @@
         Profile.remove_sections("configuration_management")
       end
 
-      if Profile.current["suse_register"]
-        return :abort unless WFM.CallFunction(
-          "scc_auto",
-          ["Import", Profile.current["suse_register"]]
-        )
-        return :abort unless WFM.CallFunction(
-          "scc_auto",
-          ["Write"]
-        )
-        # failed relnotes download is not fatal, ignore ret code
-        WFM.CallFunction("inst_download_release_notes")
-      elsif general_section["semi-automatic"] &&
-          general_section["semi-automatic"].include?("scc")
-
-        Call.Function("inst_scc", ["enable_next" => true])
-      end
+      # Register system
+      return :abort unless suse_register
 
       # Software
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.0.57/src/clients/inst_autosetup_upgrade.rb 
new/autoyast2-4.0.60/src/clients/inst_autosetup_upgrade.rb
--- old/autoyast2-4.0.57/src/clients/inst_autosetup_upgrade.rb  2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/src/clients/inst_autosetup_upgrade.rb  2018-08-22 
10:08:42.000000000 +0200
@@ -223,27 +223,10 @@
       end
 
       # Registration
-      # FIXME: There is a lot of duplicate code with inst_autosetup.
 
       return :abort if Popup.ConfirmAbort(:painless) if UI.PollInput == :abort
       Progress.NextStage
-
-      if Profile.current["suse_register"]
-        return :abort unless WFM.CallFunction(
-          "scc_auto",
-          ["Import", Profile.current["suse_register"]]
-        )
-        return :abort unless WFM.CallFunction(
-          "scc_auto",
-          ["Write"]
-        )
-       # failed relnotes download is not fatal, ignore ret code
-       WFM.CallFunction("inst_download_release_notes")
-      elsif general_section["semi-automatic"] &&
-          general_section["semi-automatic"].include?("scc")
-
-        Call.Function("inst_scc", ["enable_next" => true])
-      end
+      return :abort unless suse_register
 
       # Software
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.0.57/src/lib/autoinstall/autosetup_helpers.rb 
new/autoyast2-4.0.60/src/lib/autoinstall/autosetup_helpers.rb
--- old/autoyast2-4.0.57/src/lib/autoinstall/autosetup_helpers.rb       
2018-07-02 16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/src/lib/autoinstall/autosetup_helpers.rb       
2018-08-22 10:08:42.000000000 +0200
@@ -22,6 +22,8 @@
 require "y2storage"
 require "autoinstall/activate_callbacks"
 
+Yast.import "Profile"
+
 module Y2Autoinstallation
   # This module defines some methods that are used in 
{Yast::InstAutosetupClient}
   # and {Yast::InstAutosetupUpgradeClient} clients. These clients need to be 
rewritten
@@ -72,7 +74,31 @@
       !!@modified_profile
     end
 
-  private
+    # System registration
+    #
+    # @return [Boolean] true if succeeded.
+    def suse_register
+      return true unless registration_module_available? # do nothing
+      general_section = Yast::Profile.current["general"] || {}
+      if Yast::Profile.current["suse_register"]
+        return false unless Yast::WFM.CallFunction(
+          "scc_auto",
+          ["Import", Yast::Profile.current["suse_register"]]
+        )
+        return false unless Yast::WFM.CallFunction(
+          "scc_auto",
+          ["Write"]
+        )
+        # failed relnotes download is not fatal, ignore ret code
+        Yast::WFM.CallFunction("inst_download_release_notes")
+      elsif general_section["semi-automatic"] &&
+          general_section["semi-automatic"].include?("scc")
+        Yast::WFM.CallFunction("inst_scc", ["enable_next" => true])
+      end
+      true
+    end
+
+private
 
     # Backup AutoYaST profile
     #
@@ -99,5 +125,19 @@
       log.info("moving modified profile: #{mvcmd}")
       Yast::SCR.Execute(path(".target.bash"), mvcmd)
     end
+
+    # Checking if the yast2-registration module is available
+    #
+    # @return [Boolean] true if yast2-registration module is available
+    def registration_module_available?
+      begin
+        require "registration/registration"
+      rescue LoadError
+        log.info "yast2-registration is not available"
+        return false
+      end
+      true
+    end
+
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/src/modules/AutoInstallRules.rb 
new/autoyast2-4.0.60/src/modules/AutoInstallRules.rb
--- old/autoyast2-4.0.57/src/modules/AutoInstallRules.rb        2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/src/modules/AutoInstallRules.rb        2018-08-22 
10:08:42.000000000 +0200
@@ -7,6 +7,7 @@
 #
 # $Id$
 require "yast"
+require "yast2/popup"
 require "y2storage"
 
 module Yast
@@ -874,94 +875,79 @@
       end
     end
 
+    #TODO: Move the responsibility of merging profiles to a specific class
+    # removing also the duplication of code between this module and the
+    # AutoinstClass one.
+
+    MERGE_CMD = "/usr/bin/xsltproc".freeze
+    MERGE_DEFAULTS = "--novalid --maxdepth 10000 --param replace 
\"'false'\"".freeze
+    MERGE_XSLT_PATH = "/usr/share/autoinstall/xslt/merge.xslt".freeze
+
+    # Merges the given profiles
+    #
+    # @param base_profile [String] the base profile file path
+    # @param with [String] the profile to be merged file path
+    # @param to [String] the resulting control file path
+    # @return [Hash] stdout and stderr output
+    def merge_profiles(base_profile, with, to)
+      dontmerge_str = ""
+      AutoinstConfig.dontmerge.each_with_index do |dm, i|
+        dontmerge_str << " --param dontmerge#{i+1} \"'#{dm}'\""
+      end
+      merge_command =
+        "#{MERGE_CMD} #{MERGE_DEFAULTS}" \
+        "#{dontmerge_str} --param with \"'#{with}'\" " \
+        "--output \"#{to}\" " \
+        "#{MERGE_XSLT_PATH} #{base_profile}"
+
+      out = SCR.Execute(path(".target.bash_output"), merge_command, {})
+      log.info("Merge command: #{merge_command}")
+      log.info("Merge stdout: #{out["stdout"]}, stderr: #{out["stderr"]}")
+      out
+    end
 
     # Merge Rule results
     # @param [String] result_profile the resulting control file path
     # @return [Boolean] true on success
     def Merge(result_profile)
-      tmpdir = AutoinstConfig.tmpDir
+      base_profile = File.join(AutoinstConfig.tmpdir, "base_profile.xml")
+      merge_profile = File.join(AutoinstConfig.tmpdir, "result.xml")
       ok = true
       skip = false
       error = false
-
-      base_profile = Ops.add(tmpdir, "/base_profile.xml")
-
-      Builtins.foreach(@tomerge) do |file|
-        Builtins.y2milestone("Working on file: %1", file)
-        current_profile = Ops.add(
-          Ops.add(AutoinstConfig.local_rules_location, "/"),
-          file
-        )
+      @tomerge.each do |file|
+        log.info("Working on file: %1", file)
+        current_profile = File.join(AutoinstConfig.local_rules_location, file)
         if !skip
-          if !XML_cleanup(current_profile, Ops.add(tmpdir, 
"/base_profile.xml"))
-            Builtins.y2error("Error reading XML file")
+          if !XML_cleanup(current_profile, base_profile)
+            log.error("Error reading XML file")
             message = _(
               "The XML parser reported an error while parsing the autoyast 
profile. The error message is:\n"
             )
-            message = Ops.add(message, XML.XMLError)
-            Popup.Error(message)
+            message += XML.XMLError
+            Yast2::Popup.show(message, headline: :error)
             error = true
           end
           skip = true
         elsif !error
-          _MergeCommand = "/usr/bin/xsltproc --novalid --param replace 
\"'false'\" "
-          dontmerge_str = ""
-          i = 1
-          Builtins.foreach(AutoinstConfig.dontmerge) do |dm|
-            dontmerge_str = Ops.add(
-              dontmerge_str,
-              Builtins.sformat(" --param dontmerge%1 \"'%2'\" ", i, dm)
-            )
-            i = Ops.add(i, 1)
-          end
-          _MergeCommand = Ops.add(_MergeCommand, dontmerge_str)
+          xsltret = merge_profiles(base_profile, current_profile, 
merge_profile)
 
-          _MergeCommand = Ops.add(_MergeCommand, "--param with ")
-          _MergeCommand = Ops.add(
-            Ops.add(Ops.add(_MergeCommand, "\"'"), current_profile),
-            "'\"  "
-          )
-          _MergeCommand = Ops.add(
-            Ops.add(Ops.add(_MergeCommand, "--output "), tmpdir),
-            "/result.xml"
-          )
-          _MergeCommand = Ops.add(
-            _MergeCommand,
-            " /usr/share/autoinstall/xslt/merge.xslt "
-          )
-          _MergeCommand = Ops.add(Ops.add(_MergeCommand, base_profile), " ")
-
-          Builtins.y2milestone("Merge command: %1", _MergeCommand)
-          xsltret = Convert.to_map(
-            SCR.Execute(path(".target.bash_output"), _MergeCommand)
-          )
-          Builtins.y2milestone("Merge result: %1", xsltret)
-          if Ops.get_integer(xsltret, "exit", -1) != 0 ||
-              Ops.get_string(xsltret, "stderr", "") != ""
-            Builtins.y2error("Merge Failed")
-            StdErrLog(Ops.get_string(xsltret, "stderr", ""))
+          log.info("Merge result: %1", xsltret)
+          if xsltret["exit"] != 0 || xsltret.fetch("stderr", "") != ""
+            log.error("Merge Failed")
+            StdErrLog(xsltret.fetch("stderr", ""))
             ok = false
           end
 
-          XML_cleanup(
-            Ops.add(tmpdir, "/result.xml"),
-            Ops.add(tmpdir, "/base_profile.xml")
-          )
+          XML_cleanup(merge_profile, base_profile)
         else
-          Builtins.y2error("Error while merging control files")
+          log.error("Error while merging control files")
         end
       end
 
       return !error if error
 
-      SCR.Execute(
-        path(".target.bash"),
-        Ops.add(
-          Ops.add(Ops.add("cp ", tmpdir), "/base_profile.xml "),
-          result_profile
-        )
-      )
-
+      SCR.Execute(path(".target.bash"), "cp #{base_profile} #{result_profile}")
       Builtins.y2milestone("Ok=%1", ok)
       @dontmergeIsDefault = true
       AutoinstConfig.dontmerge = deep_copy(@dontmergeBackup)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/src/modules/AutoinstClass.rb 
new/autoyast2-4.0.60/src/modules/AutoinstClass.rb
--- old/autoyast2-4.0.57/src/modules/AutoinstClass.rb   2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/src/modules/AutoinstClass.rb   2018-08-22 
10:08:42.000000000 +0200
@@ -112,6 +112,9 @@
       nil
     end
 
+    MERGE_CMD = "/usr/bin/xsltproc".freeze
+    MERGE_DEFAULTS = "--novalid --maxdepth 10000 --param replace 
\"'false'\"".freeze
+
     # Merge classes
     #
     def MergeClasses(configuration, base_profile, resultFileName)
@@ -120,7 +123,7 @@
         dontmerge_str << " --param dontmerge#{i+1} \"'#{dm}'\" "
       end
       merge_command =
-        "/usr/bin/xsltproc --novalid --param replace \"'false'\" 
#{dontmerge_str} --param with " \
+        "#{MERGE_CMD} #{MERGE_DEFAULTS} #{dontmerge_str} --param with " \
         "\"'#{findPath(configuration["name"], configuration["class"])}'\"  " \
         "--output #{File.join(AutoinstConfig.tmpDir, resultFileName)}  " \
         "#{MERGE_XSLT_PATH} #{base_profile} "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/src/modules/Profile.rb 
new/autoyast2-4.0.60/src/modules/Profile.rb
--- old/autoyast2-4.0.57/src/modules/Profile.rb 2018-07-02 16:32:34.000000000 
+0200
+++ new/autoyast2-4.0.60/src/modules/Profile.rb 2018-08-22 10:08:42.000000000 
+0200
@@ -7,6 +7,7 @@
 #
 # $Id$
 require "yast"
+require "yast2/popup"
 
 module Yast
   class ProfileClass < Module
@@ -745,15 +746,17 @@
         @current = XML.XMLToYCPFile(file)
       end
 
-      if @current != {} && Builtins.size(@current) == 0
+      xml_error = XML.XMLError
+      if xml_error && !xml_error.empty?
         # autoyast has read the autoyast configuration file but something went 
wrong
         message = _(
           "The XML parser reported an error while parsing the autoyast 
profile. The error message is:\n"
         )
-        message = Ops.add(message, XML.XMLError)
-        Popup.Error(message)
+        message += xml_error
+        Yast2::Popup.show(message, headline: :error)
         return false
       end
+
       Import(@current)
       true
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/test/AutoInstallRules_test.rb 
new/autoyast2-4.0.60/test/AutoInstallRules_test.rb
--- old/autoyast2-4.0.57/test/AutoInstallRules_test.rb  2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/test/AutoInstallRules_test.rb  2018-08-22 
10:08:42.000000000 +0200
@@ -208,4 +208,75 @@
       end
     end
   end
+
+  describe '#merge_profiles' do
+    let(:base_profile_path) { File.join(FIXTURES_PATH, 'profiles', 
'partitions.xml') }
+    let(:tmp_dir) { File.join(root_path, 'tmp') }
+    let(:expected_xml) { File.read(expected_xml_path) }
+    let(:output_path) { File.join(tmp_dir, 'output.xml') }
+    let(:to_merge_path) { File.join(FIXTURES_PATH, 'classes', 'swap', 
'largeswap.xml') }
+    let(:output_xml) { File.read(output_path) }
+    let(:dontmerge) { [] }
+    let(:merge_xslt_path) { File.join(root_path, 'xslt', 'merge.xslt') }
+    let(:xsltproc_command) {
+      "/usr/bin/xsltproc --novalid --maxdepth 10000 --param replace 
\"'false'\" " \
+      "--param with \"'#{to_merge_path}'\" "\
+      "--output \"#{output_path}\" " \
+      "#{merge_xslt_path} #{base_profile_path}"
+    }
+
+    before(:each) do
+      stub_const("Yast::AutoInstallRulesClass::MERGE_XSLT_PATH", 
merge_xslt_path)
+    end
+
+    around(:each) do |example|
+      FileUtils.rm_rf(tmp_dir) if Dir.exist?(tmp_dir)
+      FileUtils.mkdir(tmp_dir)
+      example.run
+      FileUtils.rm_rf(tmp_dir)
+    end
+
+    before(:each) do
+      allow(Yast::AutoinstConfig).to receive(:tmpDir).and_return(tmp_dir)
+      allow(Yast::AutoinstConfig).to receive(:dontmerge).and_return(dontmerge)
+      subject.Files
+    end
+
+    it 'executes xsltproc and returns a hash with info about the result' do
+      expect(Yast::SCR).to receive(:Execute).
+        with(Yast::Path.new(".target.bash_output"), xsltproc_command, 
{}).and_call_original
+      out = subject.merge_profiles(base_profile_path, to_merge_path, 
output_path)
+      expect(out).to eq({ 'exit' => 0, 'stderr' => '', 'stdout' => '' })
+    end
+
+    context 'when all elements must be merged' do
+      let(:expected_xml_path) { File.join(root_path, 'test', 'fixtures', 
'output', 'partitions-merged.xml')  }
+
+      it 'merges elements from the base profile and the rule profile' do
+        expect(Yast::SCR).to receive(:Execute).
+          with(Yast::Path.new(".target.bash_output"), xsltproc_command, 
{}).and_call_original
+        out = subject.merge_profiles(base_profile_path, to_merge_path, 
output_path)
+        expect(output_xml).to eq(expected_xml)
+      end
+    end
+
+    context 'when some elements are not intended to be merged' do
+      let(:expected_xml_path) { File.join(root_path, 'test', 'fixtures', 
'output', 'partitions-dontmerge.xml')  }
+      let(:dontmerge) { ['partition'] }
+      let(:xsltproc_command) {
+        "/usr/bin/xsltproc --novalid --maxdepth 10000 --param replace 
\"'false'\" " \
+        "--param dontmerge1 \"'partition'\" " \
+        "--param with \"'#{to_merge_path}'\" "\
+        "--output \"#{output_path}\" " \
+        "#{merge_xslt_path} #{base_profile_path}"
+      }
+
+      it 'does not merge those elements' do
+        expect(Yast::SCR).to receive(:Execute).
+          with(Yast::Path.new(".target.bash_output"), xsltproc_command, 
{}).and_call_original
+        out = subject.merge_profiles(base_profile_path, to_merge_path, 
output_path)
+        expect(output_xml).to eq(expected_xml)
+      end
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/test/AutoinstClass_test.rb 
new/autoyast2-4.0.60/test/AutoinstClass_test.rb
--- old/autoyast2-4.0.57/test/AutoinstClass_test.rb     2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/test/AutoinstClass_test.rb     2018-08-22 
10:08:42.000000000 +0200
@@ -222,7 +222,7 @@
     let(:merge_xslt_path) { File.join(ROOT_PATH, 'xslt', 'merge.xslt') }
     let(:conf_to_merge) { { "class" => "swap", "name" => "largeswap.xml" } }
     let(:xsltproc_command) {
-      "/usr/bin/xsltproc --novalid --param replace \"'false'\"  " \
+      "/usr/bin/xsltproc --novalid --maxdepth 10000 --param replace 
\"'false'\"  " \
       "--param with \"'#{subject.findPath("largeswap.xml", "swap")}'\"  "\
       "--output #{File.join(tmp_dir, "output.xml")}  " \
       "#{merge_xslt_path} #{base_profile_path} "
@@ -267,7 +267,7 @@
       let(:expected_xml_path) { File.join(ROOT_PATH, 'test', 'fixtures', 
'output', 'partitions-dontmerge.xml')  }
       let(:dontmerge) { ['partition'] }
       let(:xsltproc_command) {
-        "/usr/bin/xsltproc --novalid --param replace \"'false'\"  " \
+        "/usr/bin/xsltproc --novalid --maxdepth 10000 --param replace 
\"'false'\"  " \
         "--param dontmerge1 \"'partition'\"  " \
         "--param with \"'#{subject.findPath("largeswap.xml", "swap")}'\"  "\
         "--output #{File.join(tmp_dir, "output.xml")}  " \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.0.57/test/lib/autosetup_helpers_test.rb 
new/autoyast2-4.0.60/test/lib/autosetup_helpers_test.rb
--- old/autoyast2-4.0.57/test/lib/autosetup_helpers_test.rb     2018-07-02 
16:32:34.000000000 +0200
+++ new/autoyast2-4.0.60/test/lib/autosetup_helpers_test.rb     2018-08-22 
10:08:42.000000000 +0200
@@ -50,6 +50,84 @@
     end
   end
 
+  describe "#suse_register" do
+    let(:profile_content) { { "general" => {} } }
+    let(:reg_module_available) { true }
+
+    before do
+      allow_any_instance_of(Y2Autoinstallation::AutosetupHelpers).to receive(
+        :registration_module_available?).and_return(reg_module_available)
+      allow(Yast::Profile).to receive(:current).and_return(profile_content)
+    end
+
+    context "yast2-register is not available" do
+      let(:reg_module_available) { false }
+      it "does not call any client and returns true." do
+        # no scc_auto call at all
+        expect(Yast::WFM).not_to receive(:CallFunction)
+        expect(client.suse_register).to eq(true)
+      end
+    end
+
+    context "yast2-register is available" do
+      let(:reg_module_available) { true }
+
+      context "suse_register tag is not defined in AY file" do
+        it "does not call any client and returns true." do
+          # no scc_auto call at all
+          expect(Yast::WFM).not_to receive(:CallFunction)
+          expect(client.suse_register).to eq(true)
+        end
+      end
+
+      context "suse_register tag is defined in AY file" do
+        let(:profile_content) { { "suse_register" => { "reg_code" => "12345" } 
} }
+
+        before do
+          allow(Yast::WFM).to 
receive(:CallFunction).with("inst_download_release_notes").and_return(true)
+          allow(Yast::WFM).to receive(:CallFunction).with("scc_auto", 
anything).and_return(true)
+        end
+
+        it "imports the registration settings from the profile" do
+          expect(Yast::WFM).to receive(:CallFunction).with("scc_auto",
+            ["Import", profile_content["suse_register"]]).and_return(true)
+          expect(Yast::WFM).to receive(:CallFunction).with("scc_auto", 
["Write"])
+            .and_return(true)
+          client.suse_register
+        end
+
+        it "downloads release notes" do
+          expect(Yast::WFM).to 
receive(:CallFunction).with("inst_download_release_notes")
+          client.suse_register
+        end
+
+        it "returns true" do
+          expect(client.suse_register).to eq(true)
+        end
+
+        context "when something goes wrong" do
+          before do
+            allow(Yast::WFM).to receive(:CallFunction).with("scc_auto", 
["Write"]).and_return(false)
+          end
+
+          it "returns false" do
+            expect(client.suse_register).to eq(false)
+          end
+        end
+      end  
+
+      context "semi-automatic is defined in AY file" do
+        let(:profile_content) { { "general" => {"semi-automatic" => ["scc"]} } 
}
+        it "shows registration screen mask and returns true" do
+          # Showing registration screen mask
+          expect(Yast::WFM).to receive(:CallFunction).with("inst_scc",
+            ["enable_next" => true])
+          expect(client.suse_register).to eq(true)
+        end
+      end
+    end
+  end
+
   describe "#readModified" do
     let(:autoinst_profile_path) { File.join(profile_dir_path, "autoinst.xml") }
     let(:modified_profile_path) { File.join(profile_dir_path, "modified.xml") }


Reply via email to