Hello community,

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

Package is "autoyast2"

Thu Sep  3 01:10:45 2020 rev:287 rq:831489 version:4.3.43

Changes:
--------
--- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes      2020-08-14 
13:10:20.617233386 +0200
+++ /work/SRC/openSUSE:Factory/.autoyast2.new.3399/autoyast2.changes    
2020-09-03 01:11:34.588415430 +0200
@@ -1,0 +2,63 @@
+Wed Sep  2 15:07:52 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Recognize installed_product and installed_product_version as
+  legal elements of rules.xml files (boo#1176089).
+- 4.3.43
+
+-------------------------------------------------------------------
+Wed Sep  2 14:58:25 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Add to erb templates more helpers (bsc#1175735)
+
+-------------------------------------------------------------------
+Tue Sep  1 11:32:48 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Use <script> elements instead of <listentry> when exporting the
+  <postpartitioning-scripts> section (related to bsc#1175714).
+- Saving log files of postpartitioning-scripts (bsc#1145269)
+  ([email protected]).
+- 4.3.42
+
+-------------------------------------------------------------------
+Thu Aug 27 13:20:00 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Fix the AutoYaST storage UI (related to bsc#1175680).
+- 4.3.41
+
+-------------------------------------------------------------------
+Wed Aug 26 10:31:54 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Unify profile element paths (bsc#1175680).
+- 4.3.40
+
+-------------------------------------------------------------------
+Wed Aug 26 08:17:59 UTC 2020 - Michal Filka <[email protected]>
+
+- bnc#1174133
+  - do not crash with internal error when the profile contains
+    corrupted signature_handling option
+- 4.3.39
+
+-------------------------------------------------------------------
+Tue Aug 25 14:17:31 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Add ability to use erb template as dynamic autoyast profile
+  (bsc#1175735)
+- 4.3.38
+
+-------------------------------------------------------------------
+Tue Aug 25 07:33:20 UTC 2020 - Ladislav Slezák <[email protected]>
+
+- Speed up finding the "autoyast()" supplements by filtering
+  packages directly on the lilbzypp level (bsc#1175317, related to
+  bsc#1146494)
+- 4.3.37
+
+-------------------------------------------------------------------
+Mon Aug 24 13:44:00 CEST 2020 - [email protected]
+
+- Reporting an error if an corrupted AY configuration file has been
+  read (bsc#160975).
+- 4.3.36
+
+-------------------------------------------------------------------

Old:
----
  autoyast2-4.3.35.tar.bz2

New:
----
  autoyast2-4.3.43.tar.bz2

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

Other differences:
------------------
++++++ autoyast2.spec ++++++
--- /var/tmp/diff_new_pack.OMhB5o/_old  2020-09-03 01:11:35.540415747 +0200
+++ /var/tmp/diff_new_pack.OMhB5o/_new  2020-09-03 01:11:35.540415747 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package autoyast2
 #
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -22,12 +22,12 @@
 %endif
 
 Name:           autoyast2
-Version:        4.3.35
+Version:        4.3.43
 Release:        0
 Summary:        YaST2 - Automated Installation
 License:        GPL-2.0-only
 Group:          System/YaST
-Url:            https://github.com/yast/yast-autoinstallation
+URL:            https://github.com/yast/yast-autoinstallation
 
 Source0:        autoyast2-%{version}.tar.bz2
 Source1:        autoyast_en_html.tar.bz2
@@ -41,8 +41,8 @@
 # xsltproc for AutoinstClass
 BuildRequires:  libxslt
 BuildRequires:  rubygem(%{rb_default_ruby_abi}:rspec)
-# AutoYaST issue handling
-BuildRequires:  yast2 >= 4.3.2
+# AutoYaST ElementPath class
+BuildRequires:  yast2 >= 4.3.20
 # FileSystems.read_default_subvol_from_target
 BuildRequires:  yast2-country
 BuildRequires:  yast2-network >= 3.1.145
@@ -66,8 +66,8 @@
 
 Requires:       autoyast2-installation = %{version}
 Requires:       libxslt
-# XML.validate
-Requires:       yast2 >= 4.3.8
+# AutoYaST ElementPath class
+Requires:       yast2 >= 4.3.20
 Requires:       yast2-core
 Requires:       yast2-country >= 3.1.13
 # Moving security module to first installation stage
@@ -130,8 +130,8 @@
 # storage-ng based version
 Requires:       yast2-update >= 3.3.0
 Requires:       yast2-xml
-# "transact_by" key in PkgPropertiesAll()
-Requires:       yast2-pkg-bindings >= 4.0.7
+# RPM dependencies in Pkg.Resolvables
+Requires:       yast2-pkg-bindings >= 4.3.0
 Requires:       yast2-ruby-bindings >= 1.0.0
 
 Provides:       yast2-trans-autoinst

++++++ autoyast2-4.3.35.tar.bz2 -> autoyast2-4.3.43.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/.rubocop.yml 
new/autoyast2-4.3.43/.rubocop.yml
--- old/autoyast2-4.3.35/.rubocop.yml   2020-08-13 09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/.rubocop.yml   2020-09-02 17:32:59.000000000 +0200
@@ -56,6 +56,9 @@
 # ExcludedMethods: refine
 Metrics/BlockLength:
   Max: 500
+  # RSpec is known as DSL with big blocks
+  Exclude:
+    - test/**/*
 
 # Offense count: 64
 # Configuration parameters: CountBlocks.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/README.md 
new/autoyast2-4.3.43/README.md
--- old/autoyast2-4.3.35/README.md      2020-08-13 09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/README.md      2020-09-02 17:32:59.000000000 +0200
@@ -122,6 +122,7 @@
 ========================
 
 * {file:doc/profile_handling.md Profile Handling}
+* {file:doc/profile_fetching.md Profile Fetching}
 * {file:doc/validation.md Profile Validation}
 * {file:doc/error_reporting.md Error Reporting}
 * {file:doc/network_scenarios.md Network Scenarios}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/doc/profile_fetching.md 
new/autoyast2-4.3.43/doc/profile_fetching.md
--- old/autoyast2-4.3.35/doc/profile_fetching.md        1970-01-01 
01:00:00.000000000 +0100
+++ new/autoyast2-4.3.43/doc/profile_fetching.md        2020-09-02 
17:32:59.000000000 +0200
@@ -0,0 +1,64 @@
+# Profile Fetching
+
+Fetching the AutoYaST profile is not a trivial process. Most of the complexity 
comes from the
+rules/classes mechanism that, suprisingly, will come into play even if no 
rules or classes has been
+defined.
+
+Before reading the rest of this document, it is recommended to have a look to 
the [Rules and
+Classes](https://documentation.suse.com/sles/15-SP2/single-html/SLES-autoyast/#rulesandclass)
+chapter in the AutoYaST guide.
+
+## The Process 
+
+The {Yast::ProfileLocationClass#Process ProfileLocationClass#Process} method 
drives the fetching process,
+although it cooperates with other modules like {Yast::AutoinstConfigClass 
AutoinstConfig} or
+{Yast::AutoInstallRulesClass AutoInstallRules}.
+
+As a first step, {Yast::ProfileLocationClass#Process 
ProfileLocationClass#Process} reads the
+profile's location from the {Yast::AutoinstConfigClass AutoinstConfig} module 
and depending on
+whether the URL points to a file or a directory, it behaves in a slightly 
different way.
+
+* If it is a file, it just downloads the file and instructs the 
{Yast::AutoInstallRulesClass
+  AutoInstallRules} module to use only that file. See 
{Yast::AutoInstallRulesClass#CreateFile
+  AutoInstallRulesClass#CreateFile}.
+* If it is a directory, it asks {Yast::AutoInstallRulesClass AutoInstallRules} 
to process the rules
+  that are supposed to live in the `rules/rules.xml`, under the given 
directory. See
+  {Yast::AutoInstallRulesClass#Read}.
+  
+In both cases, the {Yast::AutoInstallRulesClass AutoInstallRules} module comes 
into play and
+generates the final `autoinst.xml`. This logic is implemented in the 
{Yast::AutoInstallRulesClass
+AutoInstallRulesClass#Process} method, which takes care of:
+
+* Merging the files according to the rules to generate the profile, even if 
just one file was given.
+* Processing the classes. If any class definition is found, their definitions 
will be loaded and
+  merged into the final profile.
+
+## Parsing AutoYaST URLs
+
+The {Yast::AutoinstConfigClass AutoinstConfig} module is the responsible, 
among other things, for
+holding the location of the profile. Once the module is imported, it reads the 
URL from the
+`install.inf` directory and extracts the relevant information into a set of 
separated components
+(`scheme`, `host`, etc.).
+
+The URL of the profile can point to a file (like 
`http://example.net/tumbleweed.xml`) or to a
+directory (`http://example.net/profiles/`). The trailing slash is important. 
+
+## Encrypted Profiles
+
+AutoYaST supports PGP-encrypted profiles. Such a scenario is handled in the
+{Yast::ProfileLocationClass#Process ProfileLocationClass#Process} method. 
However, it looks like the
+{Yast::ProfileClass#ReadXML ProfileClass#ReadXML} implements its own logic to 
decrypt profiles, so
+extracting this logic to a new class might be the right thing to do.
+
+## Default Rules
+
+In case that not suitable rules are found (because the `rules/rules.xml` file 
does not exist),
+AutoYaST uses a set of default rules. These rules are based in the host ID 
(the IP in hex format)
+and the MAC address of the system. Check the 
{Yast::AutoInstallRulesClass#CreateDefault
+AutoinstallRulesClass#CreateDefault} method for further details.
+
+## Additional Notes
+
+Almost the {Yast::AutoinstConfigClass AutoinstConfig} is responsible for 
parsing the AutoYaST URL,
+some further processing is performed in the {Yast::ProfileLocationClass 
ProfileLocation} method when
+dealing with `relurl` and `file` schemas.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/package/autoyast2.changes 
new/autoyast2-4.3.43/package/autoyast2.changes
--- old/autoyast2-4.3.35/package/autoyast2.changes      2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/package/autoyast2.changes      2020-09-02 
17:32:59.000000000 +0200
@@ -1,4 +1,67 @@
 -------------------------------------------------------------------
+Wed Sep  2 15:07:52 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Recognize installed_product and installed_product_version as
+  legal elements of rules.xml files (boo#1176089).
+- 4.3.43
+
+-------------------------------------------------------------------
+Wed Sep  2 14:58:25 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Add to erb templates more helpers (bsc#1175735)
+
+-------------------------------------------------------------------
+Tue Sep  1 11:32:48 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Use <script> elements instead of <listentry> when exporting the
+  <postpartitioning-scripts> section (related to bsc#1175714).
+- Saving log files of postpartitioning-scripts (bsc#1145269)
+  ([email protected]).
+- 4.3.42
+
+-------------------------------------------------------------------
+Thu Aug 27 13:20:00 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Fix the AutoYaST storage UI (related to bsc#1175680).
+- 4.3.41
+
+-------------------------------------------------------------------
+Wed Aug 26 10:31:54 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Unify profile element paths (bsc#1175680).
+- 4.3.40
+
+-------------------------------------------------------------------
+Wed Aug 26 08:17:59 UTC 2020 - Michal Filka <[email protected]>
+
+- bnc#1174133
+  - do not crash with internal error when the profile contains
+    corrupted signature_handling option
+- 4.3.39
+
+-------------------------------------------------------------------
+Tue Aug 25 14:17:31 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Add ability to use erb template as dynamic autoyast profile
+  (bsc#1175735)
+- 4.3.38
+
+-------------------------------------------------------------------
+Tue Aug 25 07:33:20 UTC 2020 - Ladislav Slezák <[email protected]>
+
+- Speed up finding the "autoyast()" supplements by filtering
+  packages directly on the lilbzypp level (bsc#1175317, related to
+  bsc#1146494)
+- 4.3.37
+
+-------------------------------------------------------------------
+Mon Aug 24 13:44:00 CEST 2020 - [email protected]
+
+- Reporting an error if an corrupted AY configuration file has been
+  read (bsc#160975).
+- 4.3.36
+
+-------------------------------------------------------------------
 Thu Aug 13 07:04:06 UTC 2020 - Michal Filka <[email protected]>
 
 - bsc#1173624
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/package/autoyast2.spec 
new/autoyast2-4.3.43/package/autoyast2.spec
--- old/autoyast2-4.3.35/package/autoyast2.spec 2020-08-13 09:52:00.000000000 
+0200
+++ new/autoyast2-4.3.43/package/autoyast2.spec 2020-09-02 17:32:59.000000000 
+0200
@@ -22,7 +22,7 @@
 %endif
 
 Name:           autoyast2
-Version:        4.3.35
+Version:        4.3.43
 Release:        0
 Summary:        YaST2 - Automated Installation
 License:        GPL-2.0-only
@@ -41,8 +41,8 @@
 # xsltproc for AutoinstClass
 BuildRequires:  libxslt
 BuildRequires:  rubygem(%{rb_default_ruby_abi}:rspec)
-# AutoYaST issue handling
-BuildRequires:  yast2 >= 4.3.2
+# AutoYaST ElementPath class
+BuildRequires:  yast2 >= 4.3.20
 # FileSystems.read_default_subvol_from_target
 BuildRequires:  yast2-xml
 BuildRequires:  yast2-transfer
@@ -66,8 +66,8 @@
 
 Requires:       autoyast2-installation = %{version}
 Requires:       libxslt
-# XML.validate
-Requires:       yast2 >= 4.3.8
+# AutoYaST ElementPath class
+Requires:       yast2 >= 4.3.20
 Requires:       yast2-core
 Requires:       yast2-country >= 3.1.13
 # Moving security module to first installation stage
@@ -130,8 +130,8 @@
 # storage-ng based version
 Requires:       yast2-update >= 3.3.0
 Requires:       yast2-xml
-# "transact_by" key in PkgPropertiesAll()
-Requires:       yast2-pkg-bindings >= 4.0.7
+# RPM dependencies in Pkg.Resolvables
+Requires:       yast2-pkg-bindings >= 4.3.0
 Requires:       yast2-ruby-bindings >= 1.0.0
 
 Provides:       yast2-trans-autoinst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/autoyast-rnc/rules.rnc 
new/autoyast2-4.3.43/src/autoyast-rnc/rules.rnc
--- old/autoyast2-4.3.35/src/autoyast-rnc/rules.rnc     2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/autoyast-rnc/rules.rnc     2020-09-02 
17:32:59.000000000 +0200
@@ -50,6 +50,8 @@
     | hostid
     | karch
     | linux
+    | installed_product
+    | installed_product_version
     | mac
     | memsize
     | network
@@ -59,29 +61,30 @@
     | totaldisk
     | xserver
 
-arch           = element arch            { MAP, (match_text & match_type?) }
-board          = element board           { MAP, (match_text & match_type?) }
-board_vendor   = element board_vendor    { MAP, (match_text & match_type?) }
-custom1        = element custom1         { MAP, (match_text & match_type? & 
script) }
-custom2        = element custom2         { MAP, (match_text & match_type? & 
script) }
-custom3        = element custom3         { MAP, (match_text & match_type? & 
script) }
-custom4        = element custom4         { MAP, (match_text & match_type? & 
script) }
-custom5        = element custom5         { MAP, (match_text & match_type? & 
script) }
-disksize       = element disksize        { MAP, (match_text & match_type?) }
-domain         = element domain          { MAP, (match_text & match_type?) }
-haspcmica      = element haspcmica       { MAP, (match_text & match_type?) }
-hostaddress    = element hostaddress     { MAP, (match_text & match_type?) }
-hostid         = element hostid          { MAP, (match_text & match_type?) }
-karch          = element karch           { MAP, (match_text & match_type?) }
-linux          = element linux           { MAP, (match_text & match_type?) }
-mac            = element mac             { MAP, (match_text & match_type?) }
-memsize        = element memsize         { MAP, (match_text & match_type?) }
-network        = element network         { MAP, (match_text & match_type?) }
-others         = element others          { MAP, (match_text & match_type?) }
-product        = element product         { MAP, (match_text & match_type?) }
-product_vendor = element product_vendor  { MAP, (match_text & match_type?) }
-totaldisk      = element totaldisk       { MAP, (match_text & match_type?) }
-xserver        = element xserver         { MAP, (match_text & match_type?) }
+arch                      = element arch                      { MAP, 
(match_text & match_type?) }
+board                     = element board                     { MAP, 
(match_text & match_type?) }
+board_vendor              = element board_vendor              { MAP, 
(match_text & match_type?) }
+custom1                   = element custom1                   { MAP, 
(match_text & match_type? & script) }
+custom2                   = element custom2                   { MAP, 
(match_text & match_type? & script) }
+custom3                   = element custom3                   { MAP, 
(match_text & match_type? & script) }
+custom4                   = element custom4                   { MAP, 
(match_text & match_type? & script) }
+custom5                   = element custom5                   { MAP, 
(match_text & match_type? & script) }
+disksize                  = element disksize                  { MAP, 
(match_text & match_type?) }
+domain                    = element domain                    { MAP, 
(match_text & match_type?) }
+hostaddress               = element hostaddress               { MAP, 
(match_text & match_type?) }
+hostid                    = element hostid                    { MAP, 
(match_text & match_type?) }
+installed_product         = element installed_product         { MAP, 
(match_text & match_type?) }
+installed_product_version = element installed_product_version { MAP, 
(match_text & match_type?) }
+karch                     = element karch                     { MAP, 
(match_text & match_type?) }
+linux                     = element linux                     { MAP, 
(match_text & match_type?) }
+mac                       = element mac                       { MAP, 
(match_text & match_type?) }
+memsize                   = element memsize                   { MAP, 
(match_text & match_type?) }
+network                   = element network                   { MAP, 
(match_text & match_type?) }
+others                    = element others                    { MAP, 
(match_text & match_type?) }
+product                   = element product                   { MAP, 
(match_text & match_type?) }
+product_vendor            = element product_vendor            { MAP, 
(match_text & match_type?) }
+totaldisk                 = element totaldisk                 { MAP, 
(match_text & match_type?) }
+xserver                   = element xserver                   { MAP, 
(match_text & match_type?) }
 
 match_type =
 element match_type { STRING_ATTR, ("greater" | "exact" | "lower" | "range" | 
"regex") }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/include/autoinstall/ask.rb 
new/autoyast2-4.3.43/src/include/autoinstall/ask.rb
--- old/autoyast2-4.3.35/src/include/autoinstall/ask.rb 2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/include/autoinstall/ask.rb 2020-09-02 
17:32:59.000000000 +0200
@@ -20,19 +20,6 @@
       Yast.import "UI"
     end
 
-    def path2pos(pa)
-      pos = []
-      Builtins.foreach(Builtins.splitstring(pa, ",")) do |p|
-        if Builtins.regexpmatch(p, "^[1,2,3,4,5,6,7,8,9,0]+$")
-          index = Builtins.tointeger(p)
-          pos = Builtins.add(pos, index)
-        else
-          pos = Builtins.add(pos, p)
-        end
-      end
-      deep_copy(pos)
-    end
-
     def createWidget(widget, _frametitle)
       widget = deep_copy(widget)
       ret = Left(widget)
@@ -423,20 +410,14 @@
 
                 # Save the value in the profile (and also as default value)
                 Ops.set(ask, "default", val)
-                pos = path2pos(Ops.get_string(ask, "path", ""))
                 if Ops.get_string(ask, "path", "") != "" # Set value in the 
profile
-                  Profile.current = Profile.setElementByList(
-                    pos,
-                    val,
-                    Profile.current
+                  Profile.current = Profile.set_element_by_path(
+                    ask["path"], val, Profile.current
                   )
                 end
                 Builtins.foreach(Ops.get_list(ask, "pathlist", [])) do |p|
-                  pos2 = path2pos(p)
-                  Profile.current = Profile.setElementByList(
-                    pos2,
-                    val,
-                    Profile.current
+                  Profile.current = Profile.set_element_by_path(
+                    p, val, Profile.current
                   )
                 end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/include/autoinstall/xml.rb 
new/autoyast2-4.3.43/src/include/autoinstall/xml.rb
--- old/autoyast2-4.3.35/src/include/autoinstall/xml.rb 2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/include/autoinstall/xml.rb 2020-09-02 
17:32:59.000000000 +0200
@@ -51,6 +51,7 @@
         "post-scripts"             => "script",
         "chroot-scripts"           => "script",
         "init-scripts"             => "script",
+        "postpartitioning-scripts" => "script",
         "local_domains"            => "domains",
         "masquerade_other_domains" => "domain",
         "masquerade_users"         => "masquerade_user",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.35/src/lib/autoinstall/package_searcher.rb 
new/autoyast2-4.3.43/src/lib/autoinstall/package_searcher.rb
--- old/autoyast2-4.3.35/src/lib/autoinstall/package_searcher.rb        
2020-08-13 09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/lib/autoinstall/package_searcher.rb        
2020-09-02 17:32:59.000000000 +0200
@@ -38,7 +38,11 @@
       package_names = {}
       log.info "Evaluating needed packages for handling AY-sections via RPM 
Supplements"
       log.info "Sections: #{sections}"
-      packages = Y2Packager::Resolvable.find(kind: :package)
+      packages = Y2Packager::Resolvable.find(
+        kind:               :package,
+        # this is a POSIX extended regexp, not a Ruby regexp!
+        supplements_regexp: "^autoyast\\(.*\\)"
+      )
 
       sections.each do |section|
         # Evaluting which package has the supplement autoyast(<section>)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.35/src/lib/autoinstall/storage_controller.rb 
new/autoyast2-4.3.43/src/lib/autoinstall/storage_controller.rb
--- old/autoyast2-4.3.35/src/lib/autoinstall/storage_controller.rb      
2020-08-13 09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/lib/autoinstall/storage_controller.rb      
2020-09-02 17:32:59.000000000 +0200
@@ -20,6 +20,8 @@
 require "yast"
 require "y2storage"
 require "autoinstall/presenters"
+require "y2storage/autoinst_profile/drive_section"
+require "y2storage/autoinst_profile/partition_section"
 
 module Y2Autoinstallation
   # Controller for editing the <partitioning> section of a profile
@@ -69,7 +71,7 @@
     def delete_section
       return unless section
 
-      if section.section_name == "drives"
+      if section.is_a?(Y2Storage::AutoinstProfile::DriveSection)
         drives.delete(section)
         self.section = drives.first
       else
@@ -109,7 +111,7 @@
     def drive
       return nil unless section
 
-      (section.section_name == "partitions") ? section.parent : section
+      section.is_a?(Y2Storage::AutoinstProfile::PartitionSection) ? 
section.parent : section
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/lib/autoinstall/y2erb.rb 
new/autoyast2-4.3.43/src/lib/autoinstall/y2erb.rb
--- old/autoyast2-4.3.35/src/lib/autoinstall/y2erb.rb   1970-01-01 
01:00:00.000000000 +0100
+++ new/autoyast2-4.3.43/src/lib/autoinstall/y2erb.rb   2020-09-02 
17:32:59.000000000 +0200
@@ -0,0 +1,119 @@
+require "yast"
+require "erb"
+
+module Y2Autoinstallation
+  class Y2ERB
+    def self.render(path)
+      env = TemplateEnvironment.new
+      template = ERB.new(File.read(path))
+      template.result(env.public_bindings) # intentional send as it is private 
method
+    end
+
+    class TemplateEnvironment
+      include Yast::Logger
+
+      def hardware
+        @hardware ||= Yast::SCR.Read(Yast::Path.new(".probe"))
+      end
+
+      # @return [Array<Hash>] list of info about disks. Info contain:
+      #   `:vendor` of disk
+      #   `:device` kernel name of device
+      #   `:udev_names` list of udev names for given disk
+      #   `:model` model name from sysfs
+      #   `:serial` serial number of disk
+      #   `:size` disk size in bytes [Integer]
+      def disks
+        return @disks if @disks
+
+        @disks = []
+        hardware["disk"].each do |disk|
+          dev_name = ::File.basename(disk["dev_name"])
+          result = {
+            vendor:     disk["vendor"],
+            device:     dev_name,
+            udev_names: disk["dev_names"]
+          }
+          result[:model] = sys_block_value(dev_name, "device/model") || 
"Unknown"
+          result[:serial] = sys_block_value(dev_name, "device/serial") || 
"Unknown"
+          result[:size] = (sys_block_value(dev_name, "device/size") || 
"-1").to_i
+
+          @disks << result
+        end
+
+        @disks
+      end
+
+      # @return [Array<Hash>] list of info about network cards. Info contain:
+      #   `:vendor` of card
+      #   `:device` name of device
+      #   `:mac` mac address of card
+      #   `:active` if card io is active [Boolean]
+      #   `:link` if card link is up [Boolean]
+      def network_cards
+        return @network_cards if @network_cards
+
+        @network_cards = []
+        hardware["netcard"].each do |card|
+          resource = card["resource"]
+          mac = begin
+                  resource["hwaddr"].first["addr"]
+                rescue StandardError
+                  ""
+                end
+          active = begin
+                     resource["io"].first["active"]
+                   rescue StandardError
+                     false
+                   end
+          link = begin
+                   resource["link"].first["state"]
+                 rescue StandardError
+                   false
+                 end
+          result = {
+            vendor: card["vendor"],
+            device: card["dev_name"],
+            mac:    mac,
+            active: active,
+            link:   link
+          }
+
+          @network_cards << result
+        end
+
+        @network_cards
+      end
+
+      # @return [Hash] list of info about OS release. Info contain:
+      #   `:name` human readable name of OS like `"openSUSE Tumbleweed"` or 
`"SLES"`
+      #   `:version` of release like `"20200727"` or `"12.5"`
+      #   `:id` id of OS like `"opensuse-tumbleweed"` or `"sles"`
+      def os_release
+        return @os_release if @os_release
+
+        Yast.import "OSRelease"
+        @os_release = {
+          name:    Yast::OSRelease.ReleaseName,
+          version: Yast::OSRelease.ReleaseVersion,
+          id:      Yast::OSRelease.id
+        }
+      end
+
+      # allow to use env bindings
+      def public_bindings
+        binding
+      end
+
+    private
+
+      def sys_block_value(device, path)
+        sys_path = "/sys/block/#{device}/"
+        ::File.read(sys_path + path).strip
+      rescue StandardError => e
+        log.warn "read of #{sys_path + path}  failed with #{e}"
+        nil
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/modules/AutoInstall.rb 
new/autoyast2-4.3.43/src/modules/AutoInstall.rb
--- old/autoyast2-4.3.35/src/modules/AutoInstall.rb     2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/modules/AutoInstall.rb     2020-09-02 
17:32:59.000000000 +0200
@@ -265,6 +265,19 @@
         )
       )
 
+      # Saving postpartitioning-scripts scripts/logs
+      postpart_dir = AutoinstConfig.tmpDir + "/postpartitioning-scripts"
+      if Yast::FileUtils.Exists(postpart_dir)
+        SCR.Execute(
+          path(".target.bash"),
+          "/bin/cp #{postpart_dir}/* #{destdir}#{AutoinstConfig.scripts_dir}"
+        )
+        SCR.Execute(
+          path(".target.bash"),
+          "/bin/cp #{postpart_dir}/logs/* #{destdir}#{AutoinstConfig.logs_dir}"
+        )
+      end
+
       nil
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/modules/AutoinstGeneral.rb 
new/autoyast2-4.3.43/src/modules/AutoinstGeneral.rb
--- old/autoyast2-4.3.35/src/modules/AutoinstGeneral.rb 2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/modules/AutoinstGeneral.rb 2020-09-02 
17:32:59.000000000 +0200
@@ -282,6 +282,8 @@
           "string (map)")
       )
 
+      return if signature_handling.empty?
+
       if signature_handling.key?("accept_unsigned_file")
         Pkg.CallbackAcceptUnsignedFile(
           if signature_handling["accept_unsigned_file"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/modules/Profile.rb 
new/autoyast2-4.3.43/src/modules/Profile.rb
--- old/autoyast2-4.3.35/src/modules/Profile.rb 2020-08-13 09:52:00.000000000 
+0200
+++ new/autoyast2-4.3.43/src/modules/Profile.rb 2020-09-02 17:32:59.000000000 
+0200
@@ -8,6 +8,7 @@
 require "yast2/popup"
 
 require "autoinstall/entries/registry"
+require "installation/autoinst_profile/element_path"
 
 module Yast
   class ProfileClass < Module
@@ -609,54 +610,62 @@
       false
     end
 
-    def setMValue(l, v, m)
-      l = deep_copy(l)
-      v = deep_copy(v)
-      m = deep_copy(m)
-      i = Ops.get_string(l, 0, "")
-      tmp = Builtins.remove(l, 0)
-      if Ops.greater_than(Builtins.size(tmp), 0)
-        if Ops.is_string?(Ops.get(tmp, 0))
-          Ops.set(m, i, setMValue(tmp, v, Ops.get_map(m, i, {})))
-        else
-          Ops.set(m, i, setLValue(tmp, v, Ops.get_list(m, i, [])))
-        end
-      else
-        Builtins.y2debug("setting %1 to %2", i, v)
-        Ops.set(m, i, v)
-      end
-      deep_copy(m)
-    end
-
-    def setLValue(l, v, m)
-      l = deep_copy(l)
-      v = deep_copy(v)
-      m = deep_copy(m)
-      i = Ops.get_integer(l, 0, 0)
-      tmp = Builtins.remove(l, 0)
-      if Ops.greater_than(Builtins.size(tmp), 0)
-        if Ops.is_string?(Ops.get(tmp, 0))
-          Ops.set(m, i, setMValue(tmp, v, Ops.get_map(m, i, {})))
+    # Returns a profile merging the given value into the specified path
+    #
+    # The path can be a String or a Installation::AutoinstProfile::ElementPath
+    # object. Although the real work is performed by {setElementByList}, it is
+    # usually preferred to use this method as it takes care of handling the
+    # path.
+    #
+    # @example Set a value using a XPath-like path
+    #   path = "//a/b"
+    #   set_element_by_path(path, 1, {}) #=> { "a" => { "b" => 1 } }
+    #
+    # @example Set a value using an ask-list style path
+    #   path = "users,0,username"
+    #   set_element_by_path(path, "root", {}) #=> { "users" => [{"username" => 
"root"}] }
+    #
+    # @param path [ElementPath,String] Profile path or string representing the 
path
+    # @param value [Object] Value to write
+    # @param profile [Hash] Initial profile
+    # @return [Hash] Modified profile
+    def set_element_by_path(path, value, profile)
+      profile_path =
+        if path.is_a?(::String)
+          ::Installation::AutoinstProfile::ElementPath.from_string(path)
         else
-          Ops.set(m, i, setLValue(tmp, v, Ops.get_list(m, i, [])))
+          path
         end
-      else
-        Builtins.y2debug("setting %1 to %2", i, v)
-        Ops.set(m, i, v)
-      end
-      deep_copy(m)
+      setElementByList(profile_path.to_a, value, profile)
     end
 
-    #  this function is a replacement for this code:
+    # Returns a profile merging the given value into the specified path
+    #
+    # The given profile is not modified.
+    #
+    # This method is a replacement for this YCP code:
     #      list<any> l = [ "key1",0,"key3" ];
     #      m[ l ] = v;
-    #  @return [Hash]
-    def setElementByList(l, v, m)
-      l = deep_copy(l)
-      v = deep_copy(v)
-      m = deep_copy(m)
-      m = setMValue(l, v, m)
-      deep_copy(m)
+    #
+    # @example Set a value
+    #   path = ["a", "b"]
+    #   setElementByList(path, 1, {}) #=> { "a" => { "b" => 1 } }
+    #
+    # @example Add an element to an array
+    #   path = ["users", 0, "username"]
+    #   setElementByList(path, "root", {}) #=> { "users" => [{"username" => 
"root"}] }
+    #
+    # @example Beware of the gaps!
+    #   path = ["users", 1, "username"]
+    #   setElementByList(path, "root", {}) #=> { "users" => [nil, {"username" 
=> "root"}] }
+    #
+    # @param path [Array<String,Integer>] Element's path
+    # @param value [Object] Value to write
+    # @param profile [Hash] Initial profile
+    # @return [Hash] Modified profile
+    def setElementByList(path, value, profile)
+      profile = deep_copy(profile)
+      merge_element_by_list(path, value, profile)
     end
 
     # @deprecated Unused, removed
@@ -777,6 +786,22 @@
         end
       end
     end
+
+    # @see setElementByList
+    def merge_element_by_list(path, value, profile)
+      current, *remaining_path = path
+      current_value =
+        if remaining_path.empty?
+          value
+        elsif remaining_path.first.is_a?(::String)
+          merge_element_by_list(remaining_path, value, profile[current] || {})
+        else
+          merge_element_by_list(remaining_path, value, profile[current] || [])
+        end
+      log.debug("Setting #{current} to #{current_value.inspect}")
+      profile[current] = current_value
+      profile
+    end
   end
 
   Profile = ProfileClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/src/modules/ProfileLocation.rb 
new/autoyast2-4.3.43/src/modules/ProfileLocation.rb
--- old/autoyast2-4.3.35/src/modules/ProfileLocation.rb 2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/src/modules/ProfileLocation.rb 2020-09-02 
17:32:59.000000000 +0200
@@ -7,6 +7,7 @@
 require "yast"
 
 require "autoinstall/xml_checks"
+require "autoinstall/y2erb"
 require "y2storage"
 
 module Yast
@@ -116,6 +117,15 @@
           return false
         end
         tmp = Convert.to_string(SCR.Read(path(".target.string"), localfile))
+
+        unless tmp.valid_encoding?
+          # TRANSLATORS: %s is the filename
+          Report.Error(
+            format(_("AutoYaST file %s\nhas no valid encoding or is 
corrupted."), filename)
+          )
+          return false
+        end
+
         l = Builtins.splitstring(tmp, "\n")
         while !tmp.nil? && Ops.get(l, 0, "") == "-----BEGIN PGP MESSAGE-----"
           Builtins.y2milestone("encrypted profile found")
@@ -159,6 +169,12 @@
           tmp = Convert.to_string(SCR.Read(path(".target.string"), localfile))
           l = Builtins.splitstring(tmp, "\n")
         end
+
+        # render erb template
+        if AutoinstConfig.filepath.end_with?(".erb")
+          res = Y2Autoinstallation::Y2ERB.render(localfile)
+          SCR.Write(path(".target.string"), localfile, res)
+        end
       else
         is_directory = true
       end
@@ -182,6 +198,9 @@
 
       return false if !is_directory && !profile_checker.valid_profile?
 
+      # no rules and classes support for erb templates
+      return true if AutoinstConfig.filepath.end_with?(".erb")
+
       ret = if is_directory
         Get(
           AutoinstConfig.scheme,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/test/ProfileLocation_test.rb 
new/autoyast2-4.3.43/test/ProfileLocation_test.rb
--- old/autoyast2-4.3.35/test/ProfileLocation_test.rb   2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/test/ProfileLocation_test.rb   2020-09-02 
17:32:59.000000000 +0200
@@ -10,16 +10,16 @@
 
   describe "#Process" do
 
-    context "when scheme is \"relurl\"" do
-      before do
-        Yast::AutoinstConfig.scheme = "relurl"
-        Yast::AutoinstConfig.xml_tmpfile = "/tmp/123"
-        Yast::AutoinstConfig.filepath = "autoinst.xml"
-        allow(Yast::InstURL).to receive(:installInf2Url).and_return(
-          "http://download.opensuse.org/distribution/leap/15.1/repo/oss/";
-        )
-      end
+    before do
+      Yast::AutoinstConfig.scheme = "relurl"
+      Yast::AutoinstConfig.xml_tmpfile = "/tmp/123"
+      Yast::AutoinstConfig.filepath = "autoinst.xml"
+      allow(Yast::InstURL).to receive(:installInf2Url).and_return(
+        "http://download.opensuse.org/distribution/leap/15.1/repo/oss/";
+      )
+    end
 
+    context "when scheme is \"relurl\"" do
       it "downloads AutoYaST configuration file with absolute path" do
         expect(subject).to receive(:Get).with("http",
           "download.opensuse.org",
@@ -28,5 +28,22 @@
         subject.Process
       end
     end
+
+    context "when scheme is corrupted" do
+      before do
+        allow(subject).to receive(:Get).with("http",
+          "download.opensuse.org",
+          "/distribution/leap/15.1/repo/oss/autoinst.xml",
+          "/tmp/123").and_return("error_string").and_return(true)
+        allow(Yast::SCR).to receive(:Read).with(Yast.path(".target.string"),
+          Yast::AutoinstConfig.xml_tmpfile).and_return("error_string")
+      end
+
+      it "reports an error" do
+        expect_any_instance_of(String).to 
receive(:valid_encoding?).and_return(false)
+        expect(Yast::Report).to receive(:Error).with(/has no valid encoding or 
is corrupted/)
+        subject.Process
+      end
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.3.35/test/lib/clients/inst_autosetup_upgrade_test.rb 
new/autoyast2-4.3.43/test/lib/clients/inst_autosetup_upgrade_test.rb
--- old/autoyast2-4.3.35/test/lib/clients/inst_autosetup_upgrade_test.rb        
2020-08-13 09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/test/lib/clients/inst_autosetup_upgrade_test.rb        
2020-09-02 17:32:59.000000000 +0200
@@ -51,6 +51,10 @@
     allow(Yast::Pkg).to receive(:ResolvableInstall)
     allow(Yast::Pkg).to receive(:ResolvableRemove)
     allow(Yast::Pkg).to receive(:PkgSolve).and_return(true)
+    # do not change the current language, using translated messages
+    # would break test expectations
+    allow(Yast::WFM).to receive(:SetLanguage)
+    allow(Yast::UI).to receive(:SetLanguage)
   end
 
   describe "#main" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/test/lib/package_searcher_test.rb 
new/autoyast2-4.3.43/test/lib/package_searcher_test.rb
--- old/autoyast2-4.3.35/test/lib/package_searcher_test.rb      2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/test/lib/package_searcher_test.rb      2020-09-02 
17:32:59.000000000 +0200
@@ -91,7 +91,8 @@
 
     before do
       allow(Y2Packager::Resolvable).to receive(:find).with(
-        kind: :package
+        kind:               :package,
+        supplements_regexp: "^autoyast\\(.*\\)"
       ).and_return(packages)
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/test/lib/storage_controller_test.rb 
new/autoyast2-4.3.43/test/lib/storage_controller_test.rb
--- old/autoyast2-4.3.35/test/lib/storage_controller_test.rb    2020-08-13 
09:52:00.000000000 +0200
+++ new/autoyast2-4.3.43/test/lib/storage_controller_test.rb    2020-09-02 
17:32:59.000000000 +0200
@@ -38,6 +38,22 @@
     end
   end
 
+  describe "#add_partition" do
+    let(:partitioning) do
+      Y2Storage::AutoinstProfile::PartitioningSection.new_from_hashes(
+        [{ "type" => :CT_DISK }]
+      )
+    end
+
+    it "adds a new partition section" do
+      subject.add_partition
+      drive = partitioning.drives.first
+      expect(drive.partitions).to contain_exactly(
+        an_instance_of(Y2Storage::AutoinstProfile::PartitionSection)
+      )
+    end
+  end
+
   describe "#delete_section" do
     let(:partitioning) do
       Y2Storage::AutoinstProfile::PartitioningSection.new_from_hashes(
@@ -49,8 +65,6 @@
         ]
       )
     end
-    let(:part_hash) do
-    end
 
     let(:drive) { partitioning.drives[2] }
     let(:first_partition) { drive.partitions.first }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/test/lib/y2erb_test.rb 
new/autoyast2-4.3.43/test/lib/y2erb_test.rb
--- old/autoyast2-4.3.35/test/lib/y2erb_test.rb 1970-01-01 01:00:00.000000000 
+0100
+++ new/autoyast2-4.3.43/test/lib/y2erb_test.rb 2020-09-02 17:32:59.000000000 
+0200
@@ -0,0 +1,235 @@
+# 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 "tempfile"
+require "autoinstall/y2erb"
+
+# reduced probe agent output
+def hardware_mock_data
+  {
+    "disk"    => [{
+      "bios_id"           => "0x80",
+      "bus"               => "PCI",
+      "bus_hwcfg"         => "pci",
+      "class_id"          => 262,
+      "detail"            => { "channel" => 0, "host" => 0, "id" => 0, "lun" 
=> 0 },
+      "dev_name"          => "/dev/nvme0n1",
+      "dev_names"         => ["/dev/nvme0n1"],
+      "dev_num"           => { "major" => 259, "minor" => 0, "range" => 0, 
"type" => "b" },
+      "device_id"         => 87056,
+      "driver"            => "nvme",
+      "driver_module"     => "nvme",
+      "model"             => "Micron Disk",
+      "old_unique_key"    => "m6To.U1c9LpxaqD7",
+      "parent_unique_key" => "svHJ.xTzyOFkYIiA",
+      "resource"          => {
+        "disk_log_geo" => [{ "cylinders" => 488386, "heads" => 64, "sectors" 
=> 32 }],
+        "size"         => [{ "unit" => "sectors", "x" => 1000215216, "y" => 
512 }]
+      },
+      "sub_class_id"      => 0,
+      "sub_device_id"     => 65792,
+      "sub_vendor"        => "Micron Technology Inc",
+      "sub_vendor_id"     => 70468,
+      "sysfs_bus_id"      => "nvme0",
+      "sysfs_id"          => "/class/block/nvme0n1",
+      "unique_key"        => "wLCS.U1c9LpxaqD7",
+      "vendor"            => "Micron Technology Inc",
+      "vendor_id"         => 70468
+    }],
+    "netcard" => [
+      {
+        "bus"               => "PCI",
+        "bus_hwcfg"         => "pci",
+        "bus_id"            => 2,
+        "class_id"          => 2,
+        "dev_name"          => "enp2s0",
+        "dev_names"         => ["enp2s0"],
+        "device"            => "RTL8111/8168/8411 PCI Express Gigabit Ethernet 
Controller",
+        "device_id"         => 98664,
+        "driver"            => "r8169",
+        "driver_module"     => "r8169",
+        "drivers"           => [{ "active" => true, "modprobe" => true,
+        "modules" => [["r8169", ""]] }],
+        "modalias"          => 
"pci:v000010ECd00008168sv00001043sd0000208Fbc02sc00i00",
+        "model"             =>
+                               "Realtek RTL8111/8168/8411 PCI Express Gigabit 
Ethernet Controller",
+        "old_unique_key"    => "bbxe.g1yJ3amPfwB",
+        "parent_unique_key" => "e6j0.CB0G3oMQsS4",
+        "resource"          => {
+          "hwaddr"  => [{ "addr"=>"a8:5e:45:c1:2f:eb" }],
+          "io"      => [{ "active" => true, "length" => 256,
+                                                            "mode" => "rw", 
"start" => 57344 }],
+          "irq"     => [{ "count" => 0, "enabled" => true,
+                                                            "irq" => 71 }],
+          "link"    => [{ "state"=>false }],
+          "mem"     =>
+                       [{ "active" => true, "length" => 4096,
+                        "start" => 4152377344 },
+                        { "active" => true, "length" => 16384,
+                        "start" => 4152360960 }],
+          "phwaddr" => [{ "addr"=>"a8:5e:45:c1:2f:eb" }]
+        },
+        "rev"               => "21",
+        "sub_class_id"      => 0,
+        "sub_device_id"     => 73871,
+        "sub_vendor"        => "ASUSTeK Computer Inc.",
+        "sub_vendor_id"     => 69699,
+        "sysfs_bus_id"      => "0000:02:00.0",
+        "sysfs_id"          => "/devices/pci0000:00/0000:00:01.2/0000:02:00.0",
+        "unique_key"        => "c3qJ.g1yJ3amPfwB",
+        "vendor"            => "Realtek Semiconductor Co., Ltd.",
+        "vendor_id"         => 69868
+      },
+      {
+        "bus"               => "PCI",
+        "bus_hwcfg"         => "pci",
+        "bus_id"            => 4,
+        "class_id"          => 2,
+        "device"            => "RTL8821CE 802.11ac PCIe Wireless Network 
Adapter",
+        "device_id"         => 116769,
+        "modalias"          => 
"pci:v000010ECd0000C821sv00001A3Bsd00003041bc02sc80i00",
+        "model"             => "Realtek RTL8821CE 802.11ac PCIe Wireless 
Network Adapter",
+        "old_unique_key"    => "aher.1HJgn3FRa50",
+        "parent_unique_key" => "yk9C.CB0G3oMQsS4",
+        "resource"          =>
+                               { "io"  =>
+                                          [{ "active" => false, "length" => 
256, "mode" => "rw",
+                                                             "start" => 53248 
}],
+                                 "irq" =>
+                                          [{ "count" => 0, "enabled" => true, 
"irq" => 255 }],
+                                 "mem" =>
+                                          [{ "active" => false, "length" => 
65536,
+                                                             "start" => 
4150263808 }] },
+        "sub_class_id"      => 128,
+        "sub_device_id"     => 77889,
+        "sub_vendor"        => "AzureWave",
+        "sub_vendor_id"     => 72251,
+        "sysfs_bus_id"      => "0000:04:00.0",
+        "sysfs_id"          => "/devices/pci0000:00/0000:00:01.7/0000:04:00.0",
+        "unique_key"        => "YmUS.1HJgn3FRa50",
+        "vendor"            => "Realtek Semiconductor Co., Ltd.",
+        "vendor_id"         => 69868
+      },
+      {
+        "bus"               => "USB",
+        "bus_hwcfg"         => "usb",
+        "class_id"          => 2,
+        "dev_name"          => "wlp5s0f4u2",
+        "dev_names"         => ["wlp5s0f4u2"],
+        "device"            => "RTL8188EUS 802.11n Wireless Network Adapter",
+        "device_id"         => 229753,
+        "driver"            => "r8188eu",
+        "driver_module"     => "r8188eu",
+        "drivers"           =>
+                               [{ "active" => true, "modprobe" => true,
+                                             "modules" => [["r8188eu", ""]] }],
+        "hotplug"           => "usb",
+        "modalias"          => 
"usb:v0BDAp8179d0000dc00dsc00dp00icFFiscFFipFFin00",
+        "model"             => "Realtek RTL8188EUS 802.11n Wireless Network 
Adapter",
+        "old_unique_key"    => "mEws.W2OkjY9u_45",
+        "parent_unique_key" => "uIhY.Md0RKo+2xQF",
+        "resource"          =>
+                               { "baud"    => [{ "speed"=>480000000 }],
+                                 "hwaddr"  => [{ "addr"=>"50:3e:aa:d7:45:9f" 
}],
+                                 "link"    => [{ "state"=>true }],
+                                 "phwaddr" => [{ "addr"=>"50:3e:aa:d7:45:9f" 
}],
+                                 "wlan"    =>
+                                              [{ "auth_modes"  => [
+                                                "open", "wpa-psk", "wpa-eap"
+                                              ],
+                                                 "bitrates"    => [
+                                                   "1", "2", "5.5", "11"
+                                                 ],
+                                                 "channels"    => [
+                                                   "1", "2", "3", "4", "5", 
"6", "7",
+                                                   "8", "9", "10", "11", "12", 
"13"
+                                                 ],
+                                                 "enc_modes"   => ["TKIP", 
"CCMP"],
+                                                 "frequencies" =>
+                                                                  ["2.412",
+                                                                   "2.417",
+                                                                   "2.422",
+                                                                   "2.427",
+                                                                   "2.432",
+                                                                   "2.437",
+                                                                   "2.442",
+                                                                   "2.447",
+                                                                   "2.452",
+                                                                   "2.457",
+                                                                   "2.462",
+                                                                   "2.467",
+                                                                   "2.472"] }] 
},
+        "sub_class_id"      => 130,
+        "sysfs_bus_id"      => "3-2:1.0",
+        "sysfs_id"          =>
+                               
"/devices/pci0000:00/0000:00:08.1/0000:05:00.4/usb3/3-2/3-2:1.0",
+        "unique_key"        => "mZxt.M1BlfozBLm7",
+        "vendor"            => "Realtek Semiconductor Corp.",
+        "vendor_id"         => 199642,
+        "wlan"              => true
+      }
+    ]
+  }
+end
+
+describe Y2Autoinstallation::Y2ERB do
+  describe ".render" do
+    it "returns string with rendered template" do
+      # mock just for optimization
+      allow(Yast::SCR).to receive(:Read).and_return(hardware_mock_data)
+      file = Tempfile.new("test")
+      path = file.path
+      file.write("<test><%= hardware.inspect %></test>")
+      file.close
+      result = described_class.render(path)
+      file.unlink
+
+      expect(result).to match(/<test>{.*}<\/test>/)
+    end
+  end
+end
+
+describe Y2Autoinstallation::Y2ERB::TemplateEnvironment do
+  before do
+    allow(Yast::SCR).to receive(:Read).and_return(hardware_mock_data)
+  end
+
+  describe "#network_cards" do
+    it "returns list of map" do
+      expect(subject.network_cards).to be_a(Array)
+      expect(subject.network_cards).to be_all(Hash)
+    end
+  end
+
+  describe "#disks" do
+    it "returns list of map" do
+      allow(::File).to receive(:read).with(/\/sys\/block/).and_return("\n")
+      expect(subject.disks).to be_a(Array)
+      expect(subject.disks).to be_all(Hash)
+    end
+  end
+
+  describe "#os_release" do
+    it "returns hash" do
+      expect(subject.os_release).to be_a(Hash)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.3.35/test/profile_test.rb 
new/autoyast2-4.3.43/test/profile_test.rb
--- old/autoyast2-4.3.35/test/profile_test.rb   2020-08-13 09:52:00.000000000 
+0200
+++ new/autoyast2-4.3.43/test/profile_test.rb   2020-09-02 17:32:59.000000000 
+0200
@@ -603,4 +603,90 @@
       expect(subject.SaveSingleSections("/tmp")).to eq({})
     end
   end
+
+  describe "#set_element_by_path" do
+    let(:profile) { double("profile") }
+    let(:value) { double("value") }
+    let(:new_profile) { double("new_profile") }
+
+    context "when a string is given as path" do
+      it "sets the element by using the path's parts" do
+        expect(subject).to receive(:setElementByList).with(
+          ["users", 0, "username"], value, profile
+        ).and_return(new_profile)
+        result = subject.set_element_by_path("users,0,username", value, 
profile)
+        expect(result).to eq(new_profile)
+      end
+    end
+
+    context "when a profile path object is given as path" do
+      let(:path) { 
Installation::AutoinstProfile::ElementPath.from_string("groups,0,name") }
+      it "sets the element by using the path's parts" do
+        expect(subject).to receive(:setElementByList).with(
+          ["groups", 0, "name"], value, profile
+        ).and_return(new_profile)
+        result = subject.set_element_by_path(path, value, profile)
+        expect(result).to eq(new_profile)
+      end
+    end
+  end
+
+  describe "#setElementByList" do
+    let(:profile) do
+      {
+        "users" => [
+          { "username" => "root" },
+          { "username" => "guest" }
+        ]
+      }
+    end
+    let(:path) { ["users", 1, "username"] }
+
+    context "when the element exists" do
+      it "replaces its value" do
+        new_profile = subject.setElementByList(path, "admin", profile)
+        expect(new_profile["users"][1]).to eq(
+          "username" => "admin"
+        )
+      end
+    end
+
+    context "when the element does not exist" do
+      let(:path) { ["users", 1, "realname"] }
+
+      it "adds the element in the given path" do
+        new_profile = subject.setElementByList(path, "Guest User", profile)
+        expect(new_profile["users"][1]).to eq(
+          "username" => "guest", "realname" => "Guest User"
+        )
+      end
+    end
+
+    context "when the element is supposed to be an array member but it does 
not exist" do
+      let(:path) { ["users", 3, "username"] }
+
+      it "adds an element to the array" do
+        new_profile = subject.setElementByList(path, "admin", profile)
+        expect(new_profile["users"][3]).to eq(
+          "username" => "admin"
+        )
+      end
+
+      it "fills any gap with nil" do
+        new_profile = subject.setElementByList(path, "admin", profile)
+        expect(new_profile["users"][2]).to be_nil
+      end
+    end
+
+    context "when parent elements are missing" do
+      let(:path) { ["groups", 0, "name"] }
+
+      it "adds all the full hierarchy up to the given path" do
+        new_profile = subject.setElementByList(path, "root", profile)
+        expect(new_profile["groups"]).to eq(
+          [{ "name" => "root" }]
+        )
+      end
+    end
+  end
 end


Reply via email to