Hello community,

here is the log from the commit of package autoyast2 for openSUSE:Factory 
checked in at 2020-07-13 09:06:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/autoyast2 (Old)
 and      /work/SRC/openSUSE:Factory/.autoyast2.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "autoyast2"

Mon Jul 13 09:06:10 2020 rev:280 rq:819901 version:4.3.22

Changes:
--------
--- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes      2020-07-05 
01:12:33.411891877 +0200
+++ /work/SRC/openSUSE:Factory/.autoyast2.new.3060/autoyast2.changes    
2020-07-13 09:06:20.532215590 +0200
@@ -1,0 +2,7 @@
+Wed Jul  8 23:41:41 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Move pre-scripts to the autoinit client running them just after
+  the profile has been processed (bsc#1110413)
+- 4.3.22
+
+-------------------------------------------------------------------

Old:
----
  autoyast2-4.3.21.tar.bz2

New:
----
  autoyast2-4.3.22.tar.bz2

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

Other differences:
------------------
++++++ autoyast2.spec ++++++
--- /var/tmp/diff_new_pack.FOvsdX/_old  2020-07-13 09:06:21.236217360 +0200
+++ /var/tmp/diff_new_pack.FOvsdX/_new  2020-07-13 09:06:21.236217360 +0200
@@ -22,7 +22,7 @@
 %endif
 
 Name:           autoyast2
-Version:        4.3.21
+Version:        4.3.22
 Release:        0
 Summary:        YaST2 - Automated Installation
 License:        GPL-2.0-only
@@ -261,6 +261,7 @@
 %{yast_clientdir}/autoinst_scripts1_finish.rb
 %{yast_clientdir}/autoinst_scripts2_finish.rb
 %{yast_clientdir}/ayast_probe.rb
+%{yast_clientdir}/inst_autosetup.rb
 %{yast_clientdir}/inst_autosetup_upgrade.rb
 %{yast_clientdir}/inst_store_upgrade_software.rb
 %{yast_clientdir}/clone_system.rb

++++++ autoyast2-4.3.21.tar.bz2 -> autoyast2-4.3.22.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.21/package/autoyast2.changes 
new/autoyast2-4.3.22/package/autoyast2.changes
--- old/autoyast2-4.3.21/package/autoyast2.changes      2020-07-03 
17:28:34.000000000 +0200
+++ new/autoyast2-4.3.22/package/autoyast2.changes      2020-07-10 
10:09:24.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Wed Jul  8 23:41:41 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Move pre-scripts to the autoinit client running them just after
+  the profile has been processed (bsc#1110413)
+- 4.3.22
+
+-------------------------------------------------------------------
 Fri Jul  3 15:04:28 UTC 2020 - Josef Reidinger <[email protected]>
 
 - Replace old module registry with newer code that is easier to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.21/package/autoyast2.spec 
new/autoyast2-4.3.22/package/autoyast2.spec
--- old/autoyast2-4.3.21/package/autoyast2.spec 2020-07-03 17:28:34.000000000 
+0200
+++ new/autoyast2-4.3.22/package/autoyast2.spec 2020-07-10 10:09:24.000000000 
+0200
@@ -22,7 +22,7 @@
 %endif
 
 Name:           autoyast2
-Version:        4.3.21
+Version:        4.3.22
 Release:        0
 Summary:        YaST2 - Automated Installation
 License:        GPL-2.0-only
@@ -261,6 +261,7 @@
 %{yast_clientdir}/autoinst_scripts1_finish.rb
 %{yast_clientdir}/autoinst_scripts2_finish.rb
 %{yast_clientdir}/ayast_probe.rb
+%{yast_clientdir}/inst_autosetup.rb
 %{yast_clientdir}/inst_autosetup_upgrade.rb
 %{yast_clientdir}/inst_store_upgrade_software.rb
 %{yast_clientdir}/clone_system.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.21/src/clients/inst_autosetup.rb 
new/autoyast2-4.3.22/src/clients/inst_autosetup.rb
--- old/autoyast2-4.3.21/src/clients/inst_autosetup.rb  2020-07-03 
17:28:34.000000000 +0200
+++ new/autoyast2-4.3.22/src/clients/inst_autosetup.rb  2020-07-10 
10:09:24.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) [2013-2019] SUSE LLC
+# Copyright (c) [2013-2020] SUSE LLC
 #
 # All Rights Reserved.
 #
@@ -17,417 +17,5 @@
 # To contact SUSE LLC about this file by physical or electronic mail, you may
 # find current contact information at www.suse.com.
 
-# File:    clients/inst_autosetup.ycp
-# Package: Auto-installation
-# Summary: Setup and prepare system for auto-installation
-# Authors: Anas Nashif <[email protected]>
-#          Uwe Gansert <[email protected]>
-#
-# $Id$
-require "autoinstall/autosetup_helpers"
-require "autoinstall/importer"
-
-module Yast
-  import "AutoinstConfig"
-
-  class InstAutosetupClient < Client
-    include Yast::Logger
-    include Y2Autoinstallation::AutosetupHelpers
-
-    Target = AutoinstConfigClass::Target
-
-    def main
-      Yast.import "Pkg"
-      Yast.import "UI"
-      textdomain "autoinst"
-
-      Yast.import "AutoInstall"
-      Yast.import "Installation"
-      Yast.import "Profile"
-      Yast.import "Progress"
-      Yast.import "Report"
-      Yast.import "AutoinstStorage"
-      Yast.import "AutoinstScripts"
-      Yast.import "AutoinstGeneral"
-      Yast.import "AutoinstSoftware"
-      Yast.import "Popup"
-      Yast.import "Arch"
-      Yast.import "Call"
-      Yast.import "ProductControl"
-      Yast.import "ServicesManager"
-      Yast.import "AutoinstFunctions"
-      Yast.import "Wizard"
-
-      Yast.include self, "autoinstall/ask.rb"
-
-      @help_text = _(
-        "<P>Please wait while the system is prepared for autoinstallation.</P>"
-      )
-      @progress_stages = [
-        _("Execute pre-install user scripts"),
-        _("Configure General Settings "),
-        _("Set up language"),
-        _("Configure security settings"),
-        _("Create partition plans"),
-        _("Configure Bootloader"),
-        _("Registration"),
-        _("Configure Software selections"),
-        _("Configure Systemd Default Target"),
-        _("Configure users and groups"),
-        _("Import SSH keys/settings"),
-        _("Confirm License")
-      ]
-
-      @progress_descriptions = [
-        _("Executing pre-install user scripts..."),
-        _("Configuring general settings..."),
-        _("Setting up language..."),
-        _("Configuring security settings"),
-        _("Creating partition plans..."),
-        _("Configuring Bootloader..."),
-        _("Registering the system..."),
-        _("Configuring Software selections..."),
-        _("Configuring Systemd Default Target..."),
-        _("Importing users and groups configuration..."),
-        _("Importing SSH keys/settings..."),
-        _("Confirming License...")
-      ]
-
-      Progress.New(
-        _("Preparing System for Automated Installation"),
-        "", # progress_title
-        Builtins.size(@progress_stages), # progress bar length
-        @progress_stages,
-        @progress_descriptions,
-        @help_text
-      )
-
-      return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)
-
-      Progress.NextStage
-
-      # Pre-Scripts
-      AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
-      AutoinstScripts.Write("pre-scripts", false)
-
-      # Reread Profile in case it was modified in pre-script
-      # User has to create the new profile in a pre-defined
-      # location for easy processing in pre-script.
-
-      return :abort if readModified == :abort
-
-      return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)
-
-      #
-      # Partitioning and Storage
-      # //////////////////////////////////////////////////////////////////////
-
-      @modified = true
-      begin
-        askDialog
-        # Pre-Scripts
-        AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
-        AutoinstScripts.Write("pre-scripts", false)
-        @ret2 = readModified
-        return :abort if @ret2 == :abort
-
-        @modified = false if @ret2 == :not_found
-        if Ops.greater_or_equal(
-          SCR.Read(path(".target.size"), "/var/lib/YaST2/restart_yast"),
-          0
-        )
-          return :restart_yast
-        end
-      end while @modified == true
-
-      # reimport scripts, for the case <ask> has changed them
-      AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
-      #
-      # Set workflow variables
-      #
-      Progress.NextStage
-
-      # Ensure that we clean product cache to avoid product from control 
(bsc#1156058)
-      AutoinstFunctions.reset_product
-      # Merging selected product
-      AutoinstSoftware.merge_product(AutoinstFunctions.selected_product)
-
-      # configure general settings
-      general_section = Profile.current["general"] || {}
-      AutoinstGeneral.Import(general_section)
-      log.info("general: #{general_section}")
-      AutoinstGeneral.Write
-
-      autosetup_network
-
-      if Builtins.haskey(Profile.current, "add-on")
-        Progress.Title(_("Handling Add-On Products..."))
-        unless Call.Function(
-          "add-on_auto",
-          ["Import", Ops.get_map(Profile.current, "add-on", {})]
-        )
-
-          log.warn("User has aborted the installation.")
-          return :abort
-        end
-        Call.Function("add-on_auto", ["Write"])
-
-        # Recover partitioning settings that were removed by the add-on_auto 
client (bsc#1073548)
-        
Yast::AutoinstStorage.import_general_settings(general_section["storage"])
-
-        # The entry "kexec_reboot" in the Product description can be set
-        # by the AutoYaST configuration setting (general/forceboot) and should
-        # not be reset by any other Product description file.
-        # So we set it here again.
-        # bnc#981434
-        AutoinstGeneral.SetRebootAfterFirstStage
-      end
-
-      #
-      # Set it in the Language module.
-      #
-      Progress.NextStage
-      Progress.Title(_("Configuring language..."))
-
-      autosetup_country
-
-      # one can override the <confirm> option by the commandline parameter 
y2confirm
-      @tmp = Convert.to_string(
-        SCR.Read(path(".target.string"), "/proc/cmdline")
-      )
-      if [email protected]? &&
-          Builtins.contains(Builtins.splitstring(@tmp, " \n"), "y2confirm")
-        AutoinstConfig.Confirm = true
-        Builtins.y2milestone("y2confirm found and confirm turned on")
-      end
-
-      return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)
-
-      # moved here from autoinit for fate #301193
-      # needs testing
-      if Arch.s390
-        if Builtins.haskey(Profile.current, "dasd")
-          Builtins.y2milestone("dasd found")
-          if Call.Function("dasd_auto", ["Import", 
Ops.get_map(Profile.current, "dasd", {})])
-            Call.Function("dasd_auto", ["Write"])
-          end
-        end
-        if Builtins.haskey(Profile.current, "zfcp")
-          Builtins.y2milestone("zfcp found")
-          if Call.Function("zfcp_auto", ["Import", 
Ops.get_map(Profile.current, "zfcp", {})])
-            Call.Function("zfcp_auto", ["Write"])
-          end
-        end
-      end
-
-      Progress.NextStage
-
-      # Importing security settings
-      autosetup_security
-      return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)
-
-      Progress.NextStage
-
-      # Pre-scripts can modify the AutoYaST profile. Even more, a pre-script 
could change
-      # the initial disks layout/configuration (e.g., by creating a new 
partition).
-      # It is difficult to evaluate whether a pre-script has modified 
something related
-      # to storage devices, so a re-probing is always performed here (related 
to bsc#1133045).
-      probe_storage
-
-      write_storage = if Profile.current["partitioning_advanced"] &&
-          !Profile.current["partitioning_advanced"].empty?
-        
AutoinstStorage.ImportAdvanced(Profile.current["partitioning_advanced"])
-      else
-        AutoinstStorage.Import(Profile.current["partitioning"])
-      end
-
-      return :abort unless write_storage
-
-      semiauto_partitions = 
general_section["semi-automatic"]&.include?("partitioning")
-
-      if semiauto_partitions
-        Builtins.y2milestone("Partitioning manual setup")
-        # Yes, do not set Storage testsuite here as we want really GUI with 
proposal
-        Call.Function("inst_disk_proposal", ["enable_next" => true])
-        write_storage = true
-      end
-
-      if write_storage &&
-          !AutoinstStorage.Write
-        Report.Error(_("Error while configuring partitions.\nTry again.\n"))
-        Builtins.y2error("Aborting...")
-        return :abort
-      end
-
-      # Bootloader
-      # The bootloader has to be called before software selection.
-      # So the software selection is aware and can manage packages
-      # needed by the bootloader (bnc#876161)
-
-      return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)
-
-      Progress.NextStage
-
-      return :abort unless WFM.CallFunction(
-        "bootloader_auto",
-        ["Import", Ops.get_map(Profile.current, "bootloader", {})]
-      )
-
-      # Registration
-      # FIXME: There is a lot of duplicate code with inst_autoupgrade.
-
-      return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)
-
-      Progress.NextStage
-
-      # The configuration_management has to be called before software 
selection.
-      # So the software selection is aware and can manage packages
-      # needed by the configuration_management.
-      if Profile.current["configuration_management"]
-        return :abort unless WFM.CallFunction(
-          "configuration_management_auto",
-          ["Import", Profile.current["configuration_management"]]
-        )
-
-        # Do not start it in second installation stage again.
-        # Provisioning will already be called in the first stage.
-        Profile.remove_sections("configuration_management")
-      end
-
-      # Register system
-      return :abort unless suse_register
-
-      # SLES only. Have to be run before software to add required packages to 
enable kdump
-      if Builtins.haskey(Profile.current, "kdump")
-        Call.Function(
-          "kdump_auto",
-          ["Import", Ops.get_map(Profile.current, "kdump", {})]
-        )
-        # Don't run it again in 2nd installation stage
-        Profile.remove_sections("kdump")
-      end
-
-      # Software
-
-      return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)
-
-      Progress.NextStage
-
-      # Evaluating package and patterns selection.
-      # Selection will be stored in PackageAI.
-      AutoinstSoftware.Import(Ops.get_map(Profile.current, "software", {}))
-
-      # Add additional packages in order to run YAST modules which
-      # have been defined in the AutoYaST configuration file.
-      # Selection will be stored in PackageAI.
-      add_yast2_dependencies if AutoinstFunctions.second_stage_required?
-
-      # Adding selections (defined in PackageAI) to libzypp and solving
-      # package dependencies.
-      if !AutoinstSoftware.Write
-        Report.Error(
-          _("Error while configuring software selections.\nTry again.\n")
-        )
-        Builtins.y2error("Aborting...")
-        return :abort
-      end
-      # fate #301321 - AutoYaST imaging support
-      # no generic images, just the ones the manual installation would use 
too, to speed up
-      # installation
-      #
-      # no check if section is available makes product default possible
-      Call.Function(
-        "deploy_image_auto",
-        ["Import", Ops.get_map(Profile.current, "deploy_image", {})]
-      )
-      Call.Function("deploy_image_auto", ["Write"])
-
-      Progress.NextStage
-
-      if Profile.current.key?("runlevel")
-        # still supporting old format "runlevel"
-        ServicesManager.import(Profile.current["runlevel"])
-        # Do not start it in second installation stage again.
-        # Writing will be called in inst_finish.
-        Profile.remove_sections("runlevel")
-      elsif Profile.current.key? "services-manager"
-        ServicesManager.import(Profile.current["services-manager"])
-        # Do not start it in second installation stage again.
-        # Writing will be called in inst_finish.
-        Profile.remove_sections("services-manager")
-      else
-        # We will have to set default entries which are defined
-        # in the import call of ServicesManager
-        ServicesManager.import({})
-      end
-
-      #
-      # Import users configuration from the profile
-      #
-      Progress.NextStage
-      autosetup_users
-
-      #
-      # Import profile settings for copying SSH keys from a
-      # previous installation
-      #
-      Progress.NextStage
-      if Profile.current["ssh_import"]
-        config = Profile.current["ssh_import"]
-        Profile.remove_sections("ssh_import")
-        return :abort unless WFM.CallFunction(
-          "ssh_import_auto",
-          ["Import", config]
-        )
-      end
-
-      #
-      # Checking Base Product licenses
-      #
-      Progress.NextStage
-      if general_section["mode"]&.fetch("confirm_base_product_license", false)
-        result = nil
-        while result != :next
-          result = WFM.CallFunction("inst_product_license", [{ 
"enable_back"=>false }])
-          return :abort if result == :abort && 
Yast::Popup.ConfirmAbort(:painless)
-        end
-      end
-
-      # Results of imported values semantic check.
-      return :abort unless AutoInstall.valid_imported_values
-
-      Progress.Finish
-
-      @ret = ProductControl.RunFrom(ProductControl.CurrentStep + 1, true)
-
-      return :finish if @ret == :next
-
-      @ret
-    end
-
-    # Import Users configuration from profile
-    def autosetup_users
-      importer.import_entry("users").each do |e|
-        Profile.remove_sections(e)
-      end
-    end
-
-    # Import security settings from profile
-    def autosetup_security
-      importer.import_entry("security").each do |e|
-        Profile.remove_sections(e)
-      end
-    end
-
-    # Add YaST2 packages dependencies
-    def add_yast2_dependencies
-      AutoinstSoftware.AddYdepsFromProfile(Profile.current.keys)
-    end
-
-    def importer
-      @importer ||= Y2Autoinstallation::Importer.new(Profile.current)
-    end
-  end
-end
-
-Yast::InstAutosetupClient.new.main
+require "autoinstall/clients/inst_autosetup"
+Y2Autoinstallation::Clients::InstAutosetup.new.main
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.21/src/lib/autoinstall/autosetup_helpers.rb 
new/autoyast2-4.3.22/src/lib/autoinstall/autosetup_helpers.rb
--- old/autoyast2-4.3.21/src/lib/autoinstall/autosetup_helpers.rb       
2020-07-03 17:28:34.000000000 +0200
+++ new/autoyast2-4.3.22/src/lib/autoinstall/autosetup_helpers.rb       
2020-07-10 10:09:24.000000000 +0200
@@ -29,7 +29,7 @@
 Yast.import "Language"
 
 module Y2Autoinstallation
-  # This module defines some methods that are used in 
{Yast::InstAutosetupClient}
+  # This module defines some methods that are used in 
{Y2Autoinstallation::Clients::InstAutosetup}
   # and {Y2Autoinstallation::Clients::InstAutosetupUpgrade} clients. These 
clients need to be
   # rewritten but, for the time being, this is the easiest way to share code 
between them.
   module AutosetupHelpers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.21/src/lib/autoinstall/clients/inst_autoinit.rb 
new/autoyast2-4.3.22/src/lib/autoinstall/clients/inst_autoinit.rb
--- old/autoyast2-4.3.21/src/lib/autoinstall/clients/inst_autoinit.rb   
2020-07-03 17:28:34.000000000 +0200
+++ new/autoyast2-4.3.22/src/lib/autoinstall/clients/inst_autoinit.rb   
2020-07-10 10:09:24.000000000 +0200
@@ -7,6 +7,7 @@
 Yast.import "AutoinstConfig"
 Yast.import "AutoinstFunctions"
 Yast.import "AutoinstGeneral"
+Yast.import "AutoinstScripts"
 Yast.import "Call"
 Yast.import "Console"
 Yast.import "InstURL"
@@ -24,6 +25,7 @@
 module Y2Autoinstallation
   module Clients
     class InstAutoinit
+      include Yast
       include Y2Autoinstallation::AutosetupHelpers
       include Yast::Logger
       include Yast::UIShortcuts
@@ -36,6 +38,8 @@
 
       def initialize
         textdomain "autoinst"
+
+        Yast.include self, "autoinstall/ask.rb"
       end
 
       def run
@@ -48,7 +52,8 @@
           _("Probe hardware"),
           _("Retrieve & Read Control File"),
           _("Parse control file"),
-          _("Initial Configuration")
+          _("Initial Configuration"),
+          _("Execute pre-install user scripts")
         ]
 
         Yast::Progress.New(
@@ -74,6 +79,15 @@
         ret = processProfile
         return ret if ret != :ok
 
+        # Run pre-scripts as soon as possible as we could modify the profile by
+        # them or by the ask dialog (bsc#1114013)
+        Yast::Progress.NextStage
+        Yast::Progress.Title(_("Executing pre-install user scripts..."))
+        log.info("Executing pre-scripts")
+
+        ret = autoinit_scripts
+        return ret if ret != :ok
+
         Yast::Progress.Finish
 
         # when installing from the online installation medium we need to
@@ -134,6 +148,39 @@
 
     private
 
+      # Import and write the profile pre-scripts running then the ask dialog 
when
+      # an ask-list is declared redoing the import and write of the 
pre-scripts as
+      # many times as needed.
+      def autoinit_scripts
+        # Pre-Scripts
+        Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {})
+        Yast::AutoinstScripts.Write("pre-scripts", false)
+
+        # Reread Profile in case it was modified in pre-script
+        # User has to create the new profile in a pre-defined
+        # location for easy processing in pre-script.
+
+        return :abort if readModified == :abort
+
+        return :abort if Yast::UI.PollInput == :abort && 
Yast::Popup.ConfirmAbort(:painless)
+
+        loop do
+          askDialog
+          # Pre-Scripts
+          Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {})
+          Yast::AutoinstScripts.Write("pre-scripts", false)
+          ret = readModified
+          return :abort if ret == :abort
+
+          return :restart_yast if File.exist?("/var/lib/YaST2/restart_yast")
+          break if ret == :not_found
+        end
+
+        # reimport scripts, for the case <ask> has changed them
+        Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {})
+        :ok
+      end
+
       # Checking profile for unsupported sections.
       def check_unsupported_profile_sections
         unsupported_sections = 
Y2Autoinstallation::Importer.new(Yast::Profile.current)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.21/src/lib/autoinstall/clients/inst_autosetup.rb 
new/autoyast2-4.3.22/src/lib/autoinstall/clients/inst_autosetup.rb
--- old/autoyast2-4.3.21/src/lib/autoinstall/clients/inst_autosetup.rb  
1970-01-01 01:00:00.000000000 +0100
+++ new/autoyast2-4.3.22/src/lib/autoinstall/clients/inst_autosetup.rb  
2020-07-10 10:09:24.000000000 +0200
@@ -0,0 +1,396 @@
+# Copyright (c) [2013-2019] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+# File:    clients/inst_autosetup.ycp
+# Package: Auto-installation
+# Summary: Setup and prepare system for auto-installation
+# Authors: Anas Nashif <[email protected]>
+#          Uwe Gansert <[email protected]>
+#
+# $Id$
+
+require "yast"
+require "autoinstall/autosetup_helpers"
+require "autoinstall/importer"
+
+Yast.import "Pkg"
+Yast.import "UI"
+Yast.import "AutoinstConfig"
+Yast.import "AutoInstall"
+Yast.import "Installation"
+Yast.import "Profile"
+Yast.import "Progress"
+Yast.import "Report"
+Yast.import "AutoinstStorage"
+Yast.import "AutoinstScripts"
+Yast.import "AutoinstGeneral"
+Yast.import "AutoinstSoftware"
+Yast.import "Popup"
+Yast.import "Arch"
+Yast.import "Call"
+Yast.import "ProductControl"
+Yast.import "ServicesManager"
+Yast.import "AutoinstFunctions"
+Yast.import "Wizard"
+
+module Y2Autoinstallation
+  module Clients
+    class InstAutosetup < Yast::Client
+      include Yast::Logger
+      include Y2Autoinstallation::AutosetupHelpers
+
+      Target = AutoinstConfigClass::Target
+
+      def main
+        textdomain "autoinst"
+
+        @help_text = _(
+          "<P>Please wait while the system is prepared for 
autoinstallation.</P>"
+        )
+        @progress_stages = [
+          _("Configure General Settings "),
+          _("Set up language"),
+          _("Configure security settings"),
+          _("Create partition plans"),
+          _("Configure Bootloader"),
+          _("Registration"),
+          _("Configure Software selections"),
+          _("Configure Systemd Default Target"),
+          _("Configure users and groups"),
+          _("Import SSH keys/settings"),
+          _("Confirm License")
+        ]
+
+        @progress_descriptions = [
+          _("Configuring general settings..."),
+          _("Setting up language..."),
+          _("Configuring security settings"),
+          _("Creating partition plans..."),
+          _("Configuring Bootloader..."),
+          _("Registering the system..."),
+          _("Configuring Software selections..."),
+          _("Configuring Systemd Default Target..."),
+          _("Importing users and groups configuration..."),
+          _("Importing SSH keys/settings..."),
+          _("Confirming License...")
+        ]
+
+        Progress.New(
+          _("Preparing System for Automated Installation"),
+          "", # progress_title
+          Builtins.size(@progress_stages), # progress bar length
+          @progress_stages,
+          @progress_descriptions,
+          @help_text
+        )
+
+        return :abort if UI.PollInput == :abort && 
Popup.ConfirmAbort(:painless)
+
+        #
+        # Set workflow variables
+        #
+        Progress.NextStage
+
+        # Ensure that we clean product cache to avoid product from control 
(bsc#1156058)
+        AutoinstFunctions.reset_product
+        # Merging selected product
+        AutoinstSoftware.merge_product(AutoinstFunctions.selected_product)
+
+        # configure general settings
+        general_section = Profile.current["general"] || {}
+        AutoinstGeneral.Import(general_section)
+        log.info("general: #{general_section}")
+        AutoinstGeneral.Write
+
+        autosetup_network
+
+        if Builtins.haskey(Profile.current, "add-on")
+          Progress.Title(_("Handling Add-On Products..."))
+          unless Call.Function(
+            "add-on_auto",
+            ["Import", Ops.get_map(Profile.current, "add-on", {})]
+          )
+
+            log.warn("User has aborted the installation.")
+            return :abort
+          end
+          Call.Function("add-on_auto", ["Write"])
+
+          # Recover partitioning settings that were removed by the add-on_auto 
client (bsc#1073548)
+          
Yast::AutoinstStorage.import_general_settings(general_section["storage"])
+
+          # The entry "kexec_reboot" in the Product description can be set
+          # by the AutoYaST configuration setting (general/forceboot) and 
should
+          # not be reset by any other Product description file.
+          # So we set it here again.
+          # bnc#981434
+          AutoinstGeneral.SetRebootAfterFirstStage
+        end
+
+        #
+        # Set it in the Language module.
+        #
+        Progress.NextStage
+        Progress.Title(_("Configuring language..."))
+
+        autosetup_country
+
+        # one can override the <confirm> option by the commandline parameter 
y2confirm
+        @tmp = Convert.to_string(
+          SCR.Read(path(".target.string"), "/proc/cmdline")
+        )
+        if [email protected]? &&
+            Builtins.contains(Builtins.splitstring(@tmp, " \n"), "y2confirm")
+          AutoinstConfig.Confirm = true
+          Builtins.y2milestone("y2confirm found and confirm turned on")
+        end
+
+        return :abort if UI.PollInput == :abort && 
Popup.ConfirmAbort(:painless)
+
+        # moved here from autoinit for fate #301193
+        # needs testing
+        if Arch.s390
+          if Builtins.haskey(Profile.current, "dasd")
+            Builtins.y2milestone("dasd found")
+            if Call.Function("dasd_auto", ["Import", 
Ops.get_map(Profile.current, "dasd", {})])
+              Call.Function("dasd_auto", ["Write"])
+            end
+          end
+          if Builtins.haskey(Profile.current, "zfcp")
+            Builtins.y2milestone("zfcp found")
+            if Call.Function("zfcp_auto", ["Import", 
Ops.get_map(Profile.current, "zfcp", {})])
+              Call.Function("zfcp_auto", ["Write"])
+            end
+          end
+        end
+
+        Progress.NextStage
+
+        # Importing security settings
+        autosetup_security
+        return :abort if UI.PollInput == :abort && 
Popup.ConfirmAbort(:painless)
+
+        #
+        # Partitioning and Storage
+        # 
//////////////////////////////////////////////////////////////////////
+
+        Progress.NextStage
+
+        # Pre-scripts can modify the AutoYaST profile. Even more, a pre-script 
could change
+        # the initial disks layout/configuration (e.g., by creating a new 
partition).
+        # It is difficult to evaluate whether a pre-script has modified 
something related
+        # to storage devices, so a re-probing is always performed here 
(related to bsc#1133045).
+        probe_storage
+
+        write_storage = if Profile.current["partitioning_advanced"] &&
+            !Profile.current["partitioning_advanced"].empty?
+          
AutoinstStorage.ImportAdvanced(Profile.current["partitioning_advanced"])
+        else
+          AutoinstStorage.Import(Profile.current["partitioning"])
+        end
+
+        return :abort unless write_storage
+
+        semiauto_partitions = 
general_section["semi-automatic"]&.include?("partitioning")
+
+        if semiauto_partitions
+          Builtins.y2milestone("Partitioning manual setup")
+          # Yes, do not set Storage testsuite here as we want really GUI with 
proposal
+          Call.Function("inst_disk_proposal", ["enable_next" => true])
+          write_storage = true
+        end
+
+        if write_storage &&
+            !AutoinstStorage.Write
+          Report.Error(_("Error while configuring partitions.\nTry again.\n"))
+          Builtins.y2error("Aborting...")
+          return :abort
+        end
+
+        # Bootloader
+        # The bootloader has to be called before software selection.
+        # So the software selection is aware and can manage packages
+        # needed by the bootloader (bnc#876161)
+
+        return :abort if UI.PollInput == :abort && 
Popup.ConfirmAbort(:painless)
+
+        Progress.NextStage
+
+        return :abort unless WFM.CallFunction(
+          "bootloader_auto",
+          ["Import", Ops.get_map(Profile.current, "bootloader", {})]
+        )
+
+        # Registration
+        # FIXME: There is a lot of duplicate code with inst_autoupgrade.
+
+        return :abort if UI.PollInput == :abort && 
Popup.ConfirmAbort(:painless)
+
+        Progress.NextStage
+
+        # The configuration_management has to be called before software 
selection.
+        # So the software selection is aware and can manage packages
+        # needed by the configuration_management.
+        if Profile.current["configuration_management"]
+          return :abort unless WFM.CallFunction(
+            "configuration_management_auto",
+            ["Import", Profile.current["configuration_management"]]
+          )
+
+          # Do not start it in second installation stage again.
+          # Provisioning will already be called in the first stage.
+          Profile.remove_sections("configuration_management")
+        end
+
+        # Register system
+        return :abort unless suse_register
+
+        # SLES only. Have to be run before software to add required packages 
to enable kdump
+        if Builtins.haskey(Profile.current, "kdump")
+          Call.Function(
+            "kdump_auto",
+            ["Import", Ops.get_map(Profile.current, "kdump", {})]
+          )
+          # Don't run it again in 2nd installation stage
+          Profile.remove_sections("kdump")
+        end
+
+        # Software
+
+        return :abort if UI.PollInput == :abort && 
Popup.ConfirmAbort(:painless)
+
+        Progress.NextStage
+
+        # Evaluating package and patterns selection.
+        # Selection will be stored in PackageAI.
+        AutoinstSoftware.Import(Ops.get_map(Profile.current, "software", {}))
+
+        # Add additional packages in order to run YAST modules which
+        # have been defined in the AutoYaST configuration file.
+        # Selection will be stored in PackageAI.
+        add_yast2_dependencies if AutoinstFunctions.second_stage_required?
+
+        # Adding selections (defined in PackageAI) to libzypp and solving
+        # package dependencies.
+        if !AutoinstSoftware.Write
+          Report.Error(
+            _("Error while configuring software selections.\nTry again.\n")
+          )
+          Builtins.y2error("Aborting...")
+          return :abort
+        end
+        # fate #301321 - AutoYaST imaging support
+        # no generic images, just the ones the manual installation would use 
too, to speed up
+        # installation
+        #
+        # no check if section is available makes product default possible
+        Call.Function(
+          "deploy_image_auto",
+          ["Import", Ops.get_map(Profile.current, "deploy_image", {})]
+        )
+        Call.Function("deploy_image_auto", ["Write"])
+
+        Progress.NextStage
+
+        if Profile.current.key?("runlevel")
+          # still supporting old format "runlevel"
+          ServicesManager.import(Profile.current["runlevel"])
+          # Do not start it in second installation stage again.
+          # Writing will be called in inst_finish.
+          Profile.remove_sections("runlevel")
+        elsif Profile.current.key? "services-manager"
+          ServicesManager.import(Profile.current["services-manager"])
+          # Do not start it in second installation stage again.
+          # Writing will be called in inst_finish.
+          Profile.remove_sections("services-manager")
+        else
+          # We will have to set default entries which are defined
+          # in the import call of ServicesManager
+          ServicesManager.import({})
+        end
+
+        #
+        # Import users configuration from the profile
+        #
+        Progress.NextStage
+        autosetup_users
+
+        #
+        # Import profile settings for copying SSH keys from a
+        # previous installation
+        #
+        Progress.NextStage
+        if Profile.current["ssh_import"]
+          config = Profile.current["ssh_import"]
+          Profile.remove_sections("ssh_import")
+          return :abort unless WFM.CallFunction(
+            "ssh_import_auto",
+            ["Import", config]
+          )
+        end
+
+        #
+        # Checking Base Product licenses
+        #
+        Progress.NextStage
+        if general_section["mode"]&.fetch("confirm_base_product_license", 
false)
+          result = nil
+          while result != :next
+            result = WFM.CallFunction("inst_product_license", [{ 
"enable_back"=>false }])
+            return :abort if result == :abort && 
Yast::Popup.ConfirmAbort(:painless)
+          end
+        end
+
+        # Results of imported values semantic check.
+        return :abort unless AutoInstall.valid_imported_values
+
+        Progress.Finish
+
+        @ret = ProductControl.RunFrom(ProductControl.CurrentStep + 1, true)
+
+        return :finish if @ret == :next
+
+        @ret
+      end
+
+      # Import Users configuration from profile
+      def autosetup_users
+        importer.import_entry("users").each do |e|
+          Profile.remove_sections(e)
+        end
+      end
+
+      # Import security settings from profile
+      def autosetup_security
+        importer.import_entry("security").each do |e|
+          Profile.remove_sections(e)
+        end
+      end
+
+      # Add YaST2 packages dependencies
+      def add_yast2_dependencies
+        AutoinstSoftware.AddYdepsFromProfile(Profile.current.keys)
+      end
+
+      def importer
+        @importer ||= Y2Autoinstallation::Importer.new(Profile.current)
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.21/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb 
new/autoyast2-4.3.22/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb
--- old/autoyast2-4.3.21/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb  
2020-07-03 17:28:34.000000000 +0200
+++ new/autoyast2-4.3.22/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb  
2020-07-10 10:09:24.000000000 +0200
@@ -58,37 +58,6 @@
 
         # configure general settings
 
-        return :abort if UI.PollInput == :abort && 
Popup.ConfirmAbort(:painless)
-
-        Progress.NextStage
-
-        # Pre-Scripts
-        AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
-        AutoinstScripts.Write("pre-scripts", false)
-
-        # Reread Profile in case it was modified in pre-script
-        # User has to create the new profile in a pre-defined
-        # location for easy processing in pre-script.
-
-        return :abort if readModified == :abort
-
-        #
-        # Partitioning and Storage
-        # 
//////////////////////////////////////////////////////////////////////
-
-        loop do
-          askDialog
-          # Pre-Scripts
-          AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
-          AutoinstScripts.Write("pre-scripts", false)
-          ret2 = readModified
-          return :abort if ret2 == :abort
-
-          break if ret2 == :not_found
-        end
-
-        # reimport scripts, for the case <ask> has changed them
-        AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
         #
         # Set workflow variables
         #
@@ -294,7 +263,6 @@
       def progress_stages
         [
           _("Configure General Settings "),
-          _("Execute pre-install user scripts"),
           _("Set up language"),
           _("Registration"),
           _("Configure Software selections"),
@@ -306,7 +274,6 @@
       def progress_descriptions
         [
           _("Configuring general settings..."),
-          _("Executing pre-install user scripts..."),
           _("Setting up language..."),
           _("Registering the system..."),
           _("Configuring Software selections..."),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.21/test/lib/clients/inst_autosetup_test.rb 
new/autoyast2-4.3.22/test/lib/clients/inst_autosetup_test.rb
--- old/autoyast2-4.3.21/test/lib/clients/inst_autosetup_test.rb        
1970-01-01 01:00:00.000000000 +0100
+++ new/autoyast2-4.3.22/test/lib/clients/inst_autosetup_test.rb        
2020-07-10 10:09:24.000000000 +0200
@@ -0,0 +1,245 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "../../test_helper"
+require "autoinstall/clients/inst_autosetup"
+
+describe Y2Autoinstallation::Clients::InstAutosetup do
+  describe "#main" do
+    let(:product) do
+      Y2Packager::Product.new(name: "SLES")
+    end
+
+    let(:cmdline) { "" }
+    let(:s390_arch) { false }
+    let(:profile) do
+      {
+        "bootloader" => { "boot" => "/dev/sda" },
+        "software"   => { "packages" => ["yast2"] }
+      }
+    end
+
+    before do
+      allow(Yast::AutoinstGeneral).to receive(:Write)
+      allow(Yast::AutoinstStorage).to receive(:Write)
+      allow(Yast::AutoinstFunctions).to 
receive(:selected_product).and_return(product)
+      allow(Yast::Progress).to receive(:Title)
+      allow(Yast::AutoinstStorage).to receive(:Import).and_return(true)
+      allow(Yast::AutoinstStorage).to receive(:Write).and_return(true)
+      allow(Yast::Profile).to receive(:current).and_return(profile)
+      allow(Yast::WFM).to receive(:CallFunction).with(/_auto/, 
Array).and_return(true)
+      allow(Yast::Popup).to receive(:ConfirmAbort).and_return(true)
+
+      allow(Yast::SCR).to receive(:Read)
+        .with(Yast::Path.new(".target.string"), "/proc/cmdline")
+        .and_return(cmdline)
+      allow(Yast::SCR).to receive(:Read).and_call_original
+
+      allow(Yast::Arch).to receive(:s390).and_return(:s390_arch)
+      allow(subject).to receive(:autosetup_network)
+      allow(subject).to receive(:autosetup_country)
+      allow(subject).to receive(:autosetup_security)
+      allow(subject).to receive(:autosetup_users)
+      allow(subject).to receive(:probe_storage)
+      allow(Yast::AutoinstSoftware).to receive(:Write).and_return(true)
+      allow(Yast::ServicesManager).to receive(:import)
+    end
+
+    it "sets up the network" do
+      expect(subject).to receive(:autosetup_network)
+      subject.main
+    end
+
+    it "sets up the country configuration" do
+      expect(subject).to receive(:autosetup_country)
+      subject.main
+    end
+
+    it "sets up the security settings" do
+      expect(subject).to receive(:autosetup_security)
+      subject.main
+    end
+
+    it "sets up the partitioning schema" do
+      expect(Yast::AutoinstStorage).to receive(:Import).and_return(true)
+      expect(Yast::AutoinstStorage).to receive(:Write).and_return(true)
+      subject.main
+    end
+
+    context "when partitioning fails" do
+      before do
+        allow(Yast::AutoinstStorage).to receive(:Write).and_return(false)
+      end
+
+      it "reports an error" do
+        expect(Yast::Report).to receive(:Error).with(/configuring partitions/)
+        subject.main
+      end
+    end
+
+    it "sets up the bootloader configuration" do
+      expect(Yast::WFM).to receive(:CallFunction)
+        .with("bootloader_auto", ["Import", profile["bootloader"]])
+      subject.main
+    end
+
+    context "when importing the bootloader configuration fails" do
+      before do
+        expect(Yast::WFM).to receive(:CallFunction)
+          .with("bootloader_auto", Array).and_return(false)
+      end
+
+      it "returns :abort" do
+        expect(subject.main).to eq(:abort)
+      end
+    end
+
+    context "when configuration management settings are present in the 
profile" do
+      let(:profile) do
+        { "configuration_management" => { "master" => "salt.localdomain" } }
+      end
+
+      let(:import_result) { true }
+
+      before do
+        allow(Yast::WFM).to 
receive(:CallFunction).with("configuration_management_auto", Array)
+          .and_return(import_result)
+      end
+
+      it "sets up the configuration management module" do
+        expect(Yast::WFM).to receive(:CallFunction)
+          .with("configuration_management_auto", ["Import", 
profile["configuration_management"]])
+          .and_return(true)
+        subject.main
+      end
+
+      it "removes the 'configuration_management' section from the profile" do
+        expect(Yast::Profile).to receive(:remove_sections)
+          .with("configuration_management")
+        subject.main
+      end
+
+      context "when importing the settings fails" do
+        let(:import_result) { false }
+
+        it "returns :abort" do
+          expect(subject.main).to eq(:abort)
+        end
+      end
+    end
+
+    context "when kdump settings are present in the profile" do
+      let(:profile) do
+        { "kdump" => { "enabled" => true } }
+      end
+
+      it "sets up the kdump module" do
+        expect(Yast::WFM).to receive(:CallFunction)
+          .with("kdump_auto", ["Import", Hash])
+          .and_return(true)
+        subject.main
+      end
+
+      it "removes the 'kdump' section from the profile" do
+        expect(Yast::Profile).to receive(:remove_sections)
+          .with("kdump")
+        subject.main
+      end
+    end
+
+    it "sets up the software" do
+      expect(Yast::AutoinstSoftware).to 
receive(:Import).with(profile["software"])
+      expect(Yast::AutoinstSoftware).to receive(:Write).and_return(true)
+      subject.main
+    end
+
+    context "when processing the software configuration fails" do
+      before do
+        allow(Yast::AutoinstSoftware).to receive(:Write).and_return(false)
+      end
+
+      it "reports and error and returns :abort" do
+        expect(Yast::Report).to receive(:Error).with(/software/)
+        expect(subject.main).to eq(:abort)
+      end
+    end
+
+    it "sets up the users" do
+      expect(subject).to receive(:autosetup_users)
+      subject.main
+    end
+
+    context "when ssh import settings are present in the profile" do
+      let(:profile) do
+        { "ssh_import" => { "import" => true } }
+      end
+
+      let(:import_result) { true }
+
+      before do
+        allow(Yast::WFM).to receive(:CallFunction).with("ssh_import", Array)
+          .and_return(import_result)
+      end
+
+      it "sets up the ssh import behavior" do
+        expect(Yast::WFM).to receive(:CallFunction)
+          .with("ssh_import_auto", ["Import", profile["ssh_import"]])
+          .and_return(true)
+        subject.main
+      end
+
+      it "removes the 'ssh_import' section from the profile" do
+        expect(Yast::Profile).to receive(:remove_sections)
+          .with("ssh_import")
+        subject.main
+      end
+
+      context "when importing the settings fails" do
+        let(:import_result) { false }
+
+        it "returns :abort" do
+          expect(subject.main).to eq(:abort)
+        end
+      end
+    end
+
+    context "when the user has to accept the base product license" do
+      let(:profile) do
+        { "general" => { "mode" => { "confirm_base_product_license" => true } 
} }
+      end
+
+      it "asks the user to accept the license" do
+        expect(Yast::WFM).to 
receive(:CallFunction).with("inst_product_license", Array)
+          .and_return(:next)
+        subject.main
+      end
+
+      context "and does not accept the license" do
+        before do
+          allow(Yast::WFM).to 
receive(:CallFunction).with("inst_product_license", Array)
+            .and_return(:abort)
+        end
+
+        it "returns :abort" do
+          expect(subject.main).to eq(:abort)
+        end
+      end
+    end
+  end
+end


Reply via email to