Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package autoyast2 for openSUSE:Factory checked in at 2021-04-10 15:26:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/autoyast2 (Old) and /work/SRC/openSUSE:Factory/.autoyast2.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "autoyast2" Sat Apr 10 15:26:15 2021 rev:300 rq:883874 version:4.4.2 Changes: -------- --- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes 2021-03-30 20:50:59.680089093 +0200 +++ /work/SRC/openSUSE:Factory/.autoyast2.new.2401/autoyast2.changes 2021-04-10 15:26:36.702324418 +0200 @@ -1,0 +2,32 @@ +Thu Apr 8 16:13:44 UTC 2021 - Steffen Winterfeldt <snw...@suse.com> + +- fix autoyast profile parser (bsc#1184508) +- 4.4.2 + +------------------------------------------------------------------- +Wed Apr 7 11:50:33 UTC 2021 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Do not crash while sorting the list of modules to be processed + during the 2nd stage (bsc#1184316). +- Prevent AutoYaST UI from crashing when trying to apply a module + changes (bsc#1184429). +- Use 'module' instead of 'listentry' when exporting pre-modules + and post-modules lists (bsc#1184342). +- Show the <ask-list> only once during autoinstallation + (bsc#1184317). +- Add the 'mkfs_options' element to the schema (bsc#1184268). +- 4.4.1 + +------------------------------------------------------------------- +Wed Apr 7 10:40:15 UTC 2021 - Steffen Winterfeldt <snw...@suse.com> + +- consistent handling of empty elements in autoyast profile (bsc#1180968) +- 4.4.0 + +------------------------------------------------------------------- +Thu Apr 1 10:27:56 UTC 2021 - Josef Reidinger <jreidin...@suse.com> + +- Fix crash during using autoyast UI (bsc#1184216) +- 4.3.76 + +------------------------------------------------------------------- Old: ---- autoyast2-4.3.75.tar.bz2 New: ---- autoyast2-4.4.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ autoyast2.spec ++++++ --- /var/tmp/diff_new_pack.1hVUuH/_old 2021-04-10 15:26:37.390325228 +0200 +++ /var/tmp/diff_new_pack.1hVUuH/_new 2021-04-10 15:26:37.390325228 +0200 @@ -22,7 +22,7 @@ %endif Name: autoyast2 -Version: 4.3.75 +Version: 4.4.2 Release: 0 Summary: YaST2 - Automated Installation License: GPL-2.0-only ++++++ autoyast2-4.3.75.tar.bz2 -> autoyast2-4.4.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/package/autoyast2.changes new/autoyast2-4.4.2/package/autoyast2.changes --- old/autoyast2-4.3.75/package/autoyast2.changes 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/package/autoyast2.changes 2021-04-08 18:39:04.000000000 +0200 @@ -1,4 +1,36 @@ ------------------------------------------------------------------- +Thu Apr 8 16:13:44 UTC 2021 - Steffen Winterfeldt <snw...@suse.com> + +- fix autoyast profile parser (bsc#1184508) +- 4.4.2 + +------------------------------------------------------------------- +Wed Apr 7 11:50:33 UTC 2021 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Do not crash while sorting the list of modules to be processed + during the 2nd stage (bsc#1184316). +- Prevent AutoYaST UI from crashing when trying to apply a module + changes (bsc#1184429). +- Use 'module' instead of 'listentry' when exporting pre-modules + and post-modules lists (bsc#1184342). +- Show the <ask-list> only once during autoinstallation + (bsc#1184317). +- Add the 'mkfs_options' element to the schema (bsc#1184268). +- 4.4.1 + +------------------------------------------------------------------- +Wed Apr 7 10:40:15 UTC 2021 - Steffen Winterfeldt <snw...@suse.com> + +- consistent handling of empty elements in autoyast profile (bsc#1180968) +- 4.4.0 + +------------------------------------------------------------------- +Thu Apr 1 10:27:56 UTC 2021 - Josef Reidinger <jreidin...@suse.com> + +- Fix crash during using autoyast UI (bsc#1184216) +- 4.3.76 + +------------------------------------------------------------------- Thu Mar 18 09:25:15 UTC 2021 - Steffen Winterfeldt <snw...@suse.com> - fix handling of empty signature-handling element in autoyast diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/package/autoyast2.spec new/autoyast2-4.4.2/package/autoyast2.spec --- old/autoyast2-4.3.75/package/autoyast2.spec 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/package/autoyast2.spec 2021-04-08 18:39:04.000000000 +0200 @@ -22,7 +22,7 @@ %endif Name: autoyast2 -Version: 4.3.75 +Version: 4.4.2 Release: 0 Summary: YaST2 - Automated Installation License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/autoyast-rnc/partitioning.rnc new/autoyast2-4.4.2/src/autoyast-rnc/partitioning.rnc --- old/autoyast2-4.3.75/src/autoyast-rnc/partitioning.rnc 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/autoyast-rnc/partitioning.rnc 2021-04-08 18:39:04.000000000 +0200 @@ -70,6 +70,7 @@ | part_loop_fs | part_lv_name | part_lvm_group + | part_mkfs_options | part_mount | part_mountby | part_filesystem_id @@ -196,6 +197,7 @@ part_uuid = element uuid { STRING } part_loop_fs = element loop_fs { BOOLEAN } +part_mkfs_options = element mkfs_options { STRING } part_mount = element mount { STRING } part_mountby = element mountby { SYMBOL } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/clients/inst_autoconfigure.rb new/autoyast2-4.4.2/src/clients/inst_autoconfigure.rb --- old/autoyast2-4.3.75/src/clients/inst_autoconfigure.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/clients/inst_autoconfigure.rb 2021-04-08 18:39:04.000000000 +0200 @@ -144,7 +144,7 @@ end # Initialize scripts stack - AutoinstScripts.Import(Profile.current.fetch("scripts", {})) + AutoinstScripts.Import(Profile.current.fetch_as_hash("scripts")) # online update if Ops.get_boolean( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/include/autoinstall/conftree.rb new/autoyast2-4.4.2/src/include/autoinstall/conftree.rb --- old/autoyast2-4.3.75/src/include/autoinstall/conftree.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/include/autoinstall/conftree.rb 2021-04-08 18:39:04.000000000 +0200 @@ -505,7 +505,7 @@ modulename = getModule if modulename != "" registry = Y2Autoinstallation::Entries::Registry.instance - description = registry.descriptions.find { |d| d.resource_name == module_name } + description = registry.descriptions.find { |d| d.resource_name == modulename } if Popup.YesNo( Builtins.sformat( _( @@ -642,6 +642,7 @@ ret = :menu_saveas elsif ret == "menu_new" # NEW Profile.Reset + registry = Y2Autoinstallation::Entries::Registry.instance registry.descriptions.each { |d| resetModule(d.resource_name) } AutoinstConfig.currentFile = "" ShowSource() if UI.WidgetExists(Id(:class_source)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/include/autoinstall/xml.rb new/autoyast2-4.4.2/src/include/autoinstall/xml.rb --- old/autoyast2-4.3.75/src/include/autoinstall/xml.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/include/autoinstall/xml.rb 2021-04-08 18:39:04.000000000 +0200 @@ -72,11 +72,13 @@ "pathlist" => "path", "patterns" => "pattern", "ports" => "port", + "post-modules" => "module", "post-packages" => "package", "post-patterns" => "pattern", "post-scripts" => "script", "postpartitioning-scripts" => "script", "ppd_options" => "ppd_option", + "pre-modules" => "module", "pre-scripts" => "script", "printcap" => "printcap_entry", "printers" => "printer", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/lib/autoinstall/autosetup_helpers.rb new/autoyast2-4.4.2/src/lib/autoinstall/autosetup_helpers.rb --- old/autoyast2-4.3.75/src/lib/autoinstall/autosetup_helpers.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/lib/autoinstall/autosetup_helpers.rb 2021-04-08 18:39:04.000000000 +0200 @@ -117,7 +117,7 @@ # # @return [Boolean] def semi_auto?(name) - general_section = Yast::Profile.current["general"] || {} + general_section = Yast::Profile.current.fetch_as_hash("general") !!general_section["semi-automatic"]&.include?(name) end @@ -126,13 +126,13 @@ # Prevent to be called twice in case of already configured return if @network_configured - networking_section = Yast::Profile.current.fetch("networking", {}) + networking_section = Yast::Profile.current.fetch_as_hash("networking") Yast::WFM.CallFunction("lan_auto", ["Import", networking_section]) # Import also the host section in order to resolve hosts only available # with the network configuration and the host entry - if Yast::Profile.current["host"] - Yast::WFM.CallFunction("host_auto", ["Import", Yast::Profile.current["host"]]) + if Yast::Profile.current.fetch_as_hash("host", nil) + Yast::WFM.CallFunction("host_auto", ["Import", Yast::Profile.current.fetch_as_hash("host")]) end if semi_auto?("networking") @@ -158,7 +158,7 @@ def network_before_proposal? return @network_before_proposal unless @network_before_proposal.nil? - networking_section = Yast::Profile.current["networking"] || {} + networking_section = Yast::Profile.current.fetch_as_hash("networking") @network_before_proposal = networking_section.fetch("setup_before_proposal", false) end @@ -166,7 +166,7 @@ # Import and configure country specific data (timezone, language and # keyboard) def autosetup_country - Yast::Language.Import(Yast::Profile.current["language"] || {}) + Yast::Language.Import(Yast::Profile.current.fetch_as_hash("language")) # Set Console font Yast::Installation.encoding = Yast::Console.SelectFont(Yast::Language.language) @@ -178,16 +178,16 @@ end if Yast::Profile.current.key?("timezone") - Yast::Timezone.Import(Yast::Profile.current["timezone"] || {}) + Yast::Timezone.Import(Yast::Profile.current.fetch_as_hash("timezone")) Yast::Profile.remove_sections("timezone") end # bnc#891808: infer keyboard from language if needed if Yast::Profile.current.key?("keyboard") - Yast::Keyboard.Import(Yast::Profile.current["keyboard"] || {}, :keyboard) + Yast::Keyboard.Import(Yast::Profile.current.fetch_as_hash("keyboard"), :keyboard) Yast::Profile.remove_sections("keyboard") elsif Yast::Profile.current.key?("language") - Yast::Keyboard.Import(Yast::Profile.current["language"] || {}, :language) + Yast::Keyboard.Import(Yast::Profile.current.fetch_as_hash("language"), :language) end Yast::Profile.remove_sections("language") if Yast::Profile.current.key?("language") @@ -199,14 +199,14 @@ # Invokes autoyast setup for firewall def autosetup_firewall - return if !Yast::Profile.current["firewall"] + return if !Yast::Profile.current.fetch_as_hash("firewall", nil) # in some cases we need to postpone firewall configuration to the second stage # we also have to guarantee that firewall is not blocking second stage in this case firewall_section = if need_second_stage_run? { "enable_firewall" => false } else - Yast::Profile.current["firewall"] + Yast::Profile.current.fetch_as_hash("firewall") end log.info("Importing Firewall settings from AY profile") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/lib/autoinstall/clients/inst_autoinit.rb new/autoyast2-4.4.2/src/lib/autoinstall/clients/inst_autoinit.rb --- old/autoyast2-4.3.75/src/lib/autoinstall/clients/inst_autoinit.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/lib/autoinstall/clients/inst_autoinit.rb 2021-04-08 18:39:04.000000000 +0200 @@ -110,20 +110,20 @@ return @ret if @ret == :abort end - if Yast::Profile.current["iscsi-client"] + if Yast::Profile.current.fetch_as_hash("iscsi-client", nil) log.info "iscsi-client found" Yast::WFM.CallFunction( "iscsi-client_auto", - ["Import", Yast::Profile.current["iscsi-client"]] + ["Import", Yast::Profile.current.fetch_as_hash("iscsi-client")] ) Yast::WFM.CallFunction("iscsi-client_auto", ["Write"]) end - if Yast::Profile.current["fcoe-client"] + if Yast::Profile.current.fetch_as_hash("fcoe-client", nil) log.info "fcoe-client found" Yast::WFM.CallFunction( "fcoe-client_auto", - ["Import", Yast::Profile.current["fcoe-client"]] + ["Import", Yast::Profile.current.fetch_as_hash("fcoe-client")] ) Yast::WFM.CallFunction("fcoe-client_auto", ["Write"]) end @@ -153,7 +153,7 @@ # many times as needed. def autoinit_scripts # Pre-Scripts - Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {}) + Yast::AutoinstScripts.Import(Yast::Profile.current.fetch_as_hash("scripts")) Yast::AutoinstScripts.Write("pre-scripts", false) # Reread Profile in case it was modified in pre-script @@ -165,9 +165,12 @@ return :abort if Yast::UI.PollInput == :abort && Yast::Popup.ConfirmAbort(:painless) loop do + # ask-list + Yast::AutoinstGeneral.Import(Yast::Profile.current.fetch("general", {})) askDialog + # Pre-Scripts - Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {}) + Yast::AutoinstScripts.Import(Yast::Profile.current.fetch_as_hash("scripts")) Yast::AutoinstScripts.Write("pre-scripts", false) ret = readModified return :abort if ret == :abort @@ -184,9 +187,9 @@ # Imports the initial profile configuration (report, general and # pre-scripts sections) def import_initial_config - Yast::Report.Import(Yast::Profile.current.fetch("report", {})) - Yast::AutoinstGeneral.Import(Yast::Profile.current.fetch("general", {})) - Yast::AutoinstScripts.Import(Yast::Profile.current.fetch("scripts", {})) + Yast::Report.Import(Yast::Profile.current.fetch_as_hash("report")) + Yast::AutoinstGeneral.Import(Yast::Profile.current.fetch_as_hash("general")) + Yast::AutoinstScripts.Import(Yast::Profile.current.fetch_as_hash("scripts")) end # Checking profile for unsupported sections. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/lib/autoinstall/clients/inst_autosetup.rb new/autoyast2-4.4.2/src/lib/autoinstall/clients/inst_autosetup.rb --- old/autoyast2-4.3.75/src/lib/autoinstall/clients/inst_autosetup.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/lib/autoinstall/clients/inst_autosetup.rb 2021-04-08 18:39:04.000000000 +0200 @@ -121,8 +121,8 @@ AutoinstSoftware.merge_product(AutoinstFunctions.selected_product) # configure general settings - general_section = Profile.current["general"] || {} - networking_section = Profile.current["networking"] || {} + general_section = Profile.current.fetch_as_hash("general") + networking_section = Profile.current.fetch_as_hash("networking") pkg_list = networking_section["managed"] ? ["NetworkManager"] : [] AutoinstGeneral.Import(general_section) log.info("general: #{general_section}") @@ -238,7 +238,7 @@ return :abort unless WFM.CallFunction( "bootloader_auto", - ["Import", Ops.get_map(Profile.current, "bootloader", {})] + ["Import", Profile.current.fetch_as_hash("bootloader")] ) Progress.NextStage @@ -369,7 +369,7 @@ # Checking Base Product licenses # Progress.NextStage - if general_section["mode"]&.fetch("confirm_base_product_license", false) + if general_section.fetch_as_hash("mode").fetch("confirm_base_product_license", false) result = nil while result != :next result = WFM.CallFunction("inst_product_license", [{ "enable_back"=>false }]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/lib/autoinstall/entries/description_sorter.rb new/autoyast2-4.4.2/src/lib/autoinstall/entries/description_sorter.rb --- old/autoyast2-4.3.75/src/lib/autoinstall/entries/description_sorter.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/lib/autoinstall/entries/description_sorter.rb 2021-04-08 18:39:04.000000000 +0200 @@ -23,6 +23,8 @@ module Entries # Worker class for sorting description according their dependencies class DescriptionSorter + include Yast::Logger + def initialize(descriptions) @descriptions = descriptions @descriptions_map = Hash[descriptions.map { |d| [d.module_name, d] }] @@ -31,10 +33,21 @@ # @return [Array<Description>] sorted module names. It should be written # from first to the last. def sort - each_node = ->(&b) { @descriptions_map.each_key(&b) } - each_child = ->(n, &b) { @descriptions_map[n].required_modules.each(&b) } + each_node = lambda do |&b| + @descriptions_map.each_key(&b) + end + + each_child = lambda do |n, &b| + desc = @descriptions_map[n] + if desc + desc.required_modules.each(&b) + else + log.error "Unknown module description '#{n}'" + end + end - TSort.tsort(each_node, each_child).map { |mn| @descriptions_map[mn] } + log.info "Sorting module descriptions: #{@descriptions.inspect}" + TSort.tsort(each_node, each_child).map { |mn| @descriptions_map[mn] }.compact end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/lib/autoinstall/pkg_gpg_check_handler.rb new/autoyast2-4.4.2/src/lib/autoinstall/pkg_gpg_check_handler.rb --- old/autoyast2-4.3.75/src/lib/autoinstall/pkg_gpg_check_handler.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/lib/autoinstall/pkg_gpg_check_handler.rb 2021-04-08 18:39:04.000000000 +0200 @@ -143,15 +143,16 @@ # If the add-on has its own specific configuration, those settings # will override to general settings. # - # @param [Hash] profile AutoYaST profile + # @param [Yast::ProfileHash] profile AutoYaST profile # @param [String] url Repository URL - # @return [Hash] Signature handling settings for the given add-on. + # @return [Yast::ProfileHash] Signature handling settings for the given add-on. def get_addon_config(profile, url) - addon_config = addons_config(profile).find { |c| c["media_url"] == url } || {} - general_config = profile.fetch("general", {}) - signature_handling = general_config.fetch("signature-handling", {}) - signature_handling = {} unless signature_handling.is_a?(Hash) - signature_handling.merge(addon_config.fetch("signature-handling", {})) + addon_config = + addons_config(profile).find { |c| c["media_url"] == url } || + Yast::ProfileHash.new + general_config = profile.fetch_as_hash("general") + general_config.fetch_as_hash("signature-handling") + .merge(addon_config.fetch_as_hash("signature-handling")) end # Get add-ons configuration @@ -159,10 +160,10 @@ # This is just a helper method that returns the //add-ons/add_on_products section # of an AutoYaST profile. # - # @param [Hash] profile AutoYaST profile. - # @return [Hash] Add-ons section from profile. + # @param [Yast::ProfileHash] profile AutoYaST profile. + # @return [Yast::ProfileHash] Add-ons section from profile. def addons_config(profile) - profile.fetch("add-on", {}).fetch("add_on_products", []) + profile.fetch_as_hash("add-on").fetch_as_array("add_on_products") end # Find the key ID for the package diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/lib/autoinstall/profile_checker.rb new/autoyast2-4.4.2/src/lib/autoinstall/profile_checker.rb --- old/autoyast2-4.3.75/src/lib/autoinstall/profile_checker.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/lib/autoinstall/profile_checker.rb 2021-04-08 18:39:04.000000000 +0200 @@ -141,8 +141,8 @@ # we need to import at least scripts if not all of them are imported if !@import_all Yast::Profile.ReadXML(filename) - Yast::AutoinstScripts.Import(Yast::Profile.current.fetch("scripts", {})) - log.info "importing scripts #{Yast::Profile.current.fetch("scripts", {})}" + Yast::AutoinstScripts.Import(Yast::Profile.current.fetch_as_hash("scripts")) + log.info "importing scripts #{Yast::Profile.current.fetch_as_hash("scripts")}" end SCRIPTS_PARAMS.each do |type, special| # pre-scripts has some expectations where profile lives diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/modules/AutoinstFunctions.rb new/autoyast2-4.4.2/src/modules/AutoinstFunctions.rb --- old/autoyast2-4.3.75/src/modules/AutoinstFunctions.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/modules/AutoinstFunctions.rb 2021-04-08 18:39:04.000000000 +0200 @@ -191,10 +191,10 @@ # @return [Y2Packager::Product] a product if exactly one product matches # the criteria, nil otherwise def identify_product_by_patterns(profile) - software = profile["software"] || {} + software = profile.fetch_as_hash("software") identify_product do |name| - software.fetch("patterns", []).any? { |p| p =~ /#{name.downcase}-.*/ } + software.fetch_as_array("patterns").any? { |p| p =~ /#{name.downcase}-.*/ } end end @@ -206,10 +206,10 @@ # @return [Y2Packager::Product] a product if exactly one product matches # the criteria, nil otherwise def identify_product_by_packages(profile) - software = profile["software"] || {} + software = profile.fetch_as_hash("software") identify_product do |name| - software.fetch("packages", []).any? { |p| p =~ /#{name.downcase}-release/ } + software.fetch_as_array("packages").any? { |p| p =~ /#{name.downcase}-release/ } end end @@ -235,7 +235,7 @@ # @param profile [Hash] AutoYaST profile # @return [String] product name def base_product_name(profile) - software = profile["software"] + software = profile.fetch_as_hash("software", nil) if software.nil? log.info("Error: given profile has not a valid software section") @@ -243,7 +243,7 @@ return nil end - software.fetch("products", []).first + software.fetch_as_array("products").first end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/modules/AutoinstGeneral.rb new/autoyast2-4.4.2/src/modules/AutoinstGeneral.rb --- old/autoyast2-4.3.75/src/modules/AutoinstGeneral.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/modules/AutoinstGeneral.rb 2021-04-08 18:39:04.000000000 +0200 @@ -169,19 +169,19 @@ # @param [Hash] settings # @return booelan def Import(settings) - settings = deep_copy(settings) + settings = Yast::ProfileHash.new(settings) SetModified() log.info "General import: #{settings.inspect}" - @mode = settings.fetch("mode", {}) + @mode = settings.fetch_as_hash("mode") @cio_ignore = settings.fetch("cio_ignore", true) - @signature_handling = settings.fetch("signature-handling", {}) - @askList = settings.fetch("ask-list", []) - @proposals = settings.fetch("proposals", []) + @signature_handling = settings.fetch_as_hash("signature-handling") + @askList = settings.fetch_as_array("ask-list") + @proposals = settings.fetch_as_array("proposals") AutoinstStorage.import_general_settings(settings["storage"]) @minimal_configuration = settings.fetch("minimal_configuration", false) @self_update = settings["self_update"] # no default as we want to know if it is explicit @self_update_url = settings["self_update_url"] - @wait = settings.fetch("wait", {}) + @wait = settings.fetch_as_hash("wait") SetSignatureHandling() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/modules/AutoinstScripts.rb new/autoyast2-4.4.2/src/modules/AutoinstScripts.rb --- old/autoyast2-4.3.75/src/modules/AutoinstScripts.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/modules/AutoinstScripts.rb 2021-04-08 18:39:04.000000000 +0200 @@ -316,11 +316,11 @@ private # Checking if the script has the right format - # @param tree [Hash] scripts section of the AutoYast configuration + # @param tree [Yast::ProfileHash] scripts section of the AutoYast configuration # @param key [String] kind of script (pre, post,..) # @return [Array<String>] of scripts def valid_scripts_for(tree, key) - tree.fetch(key, []).select do |h| + tree.fetch_as_array(key).select do |h| next true if h.is_a?(Hash) log.warn "Cannot evaluate #{key}: #{h.inspect}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/src/modules/Profile.rb new/autoyast2-4.4.2/src/modules/Profile.rb --- old/autoyast2-4.3.75/src/modules/Profile.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/src/modules/Profile.rb 2021-04-08 18:39:04.000000000 +0200 @@ -14,6 +14,70 @@ require "ui/password_dialog" module Yast + # Wrapper class around Hash to hold the autoyast profile. + # + # Rationale: + # + # The profile parser returns an empty String for empty elements like + # <foo/> - and not nil. This breaks the code assumption that you can write + # xxx.fetch("foo", {}) in a lot of code locations. + # + # To make access to profile elements easier this class provides methods + # #fetch_as_hash and #fetch_as_array that check the expected type and + # return the default value also if there is a type mismatch. + # + # See bsc#1180968 for more details. + # + # The class constructor converts an existing Hash to a ProfileHash. + # + class ProfileHash < Hash + include Yast::Logger + + # Replace Hash -> ProfileHash recursively. + def initialize(default = {}) + default.each_pair do |key, value| + self[key] = value.is_a?(Hash) ? ProfileHash.new(value) : value + end + end + + # Read element from ProfileHash. + # + # @param key [String] the key + # @param default [Hash] default value - returned if element does not exist or has wrong type + # + # @return [ProfileHash] + def fetch_as_hash(key, default = {}) + fetch_as(key, Hash, default) + end + + # Read element from ProfileHash. + # + # @param key [String] the key + # @param default [Array] default value - returned if element does not exist or has wrong type + # + # @return [Array] + def fetch_as_array(key, default = []) + fetch_as(key, Array, default) + end + + private + + # With an explicit default it's possible to check for the presence of an + # element vs. empty element, if needed. + def fetch_as(key, type, default = nil) + tmp = fetch(key, nil) + if !tmp.is_a?(type) + f = caller_locations(2, 1).first + if !tmp.nil? + log.warn "AutoYaST profile type mismatch (from #{f}): " \ + "#{key}: expected #{type}, got #{tmp.class}" + end + tmp = default.is_a?(Hash) ? ProfileHash.new(default) : default + end + tmp + end + end + class ProfileClass < Module include Yast::Logger @@ -69,21 +133,22 @@ end def softwareCompat - Ops.set(@current, "software", Ops.get_map(@current, "software", {})) + @current["software"] = @current.fetch_as_hash("software") # We need to check if second stage was disabled in the profile itself # because AutoinstConfig is not initialized at this point # and InstFuntions#second_stage_required? depends on that module # to check if 2nd stage is required (chicken-and-egg problem). - mode = @current.fetch("general", {}).fetch("mode", {}) + mode = @current.fetch_as_hash("general").fetch_as_hash("mode") second_stage_enabled = mode.key?("second_stage") ? mode["second_stage"] : true + add_autoyast_packages if AutoinstFunctions.second_stage_required? && second_stage_enabled # workaround for missing "REQUIRES" in content file to stay backward compatible # FIXME: needs a more sophisticated or compatibility breaking solution after SLES11 - if Builtins.size(Ops.get_list(@current, ["software", "patterns"], [])) == 0 - Ops.set(@current, ["software", "patterns"], ["base"]) - end + patterns = @current["software"].fetch_as_array("patterns") + patterns = ["base"] if patterns.empty? + @current["software"]["patterns"] = patterns nil end @@ -201,14 +266,14 @@ end # Read Profile properties and Version - # @param properties [Hash] Profile Properties + # @param properties [ProfileHash] Profile Properties # @return [void] def check_version(properties) version = properties["version"] if version != "3.0" - Builtins.y2milestone("Wrong profile version '#{version}'") + log.info("Wrong profile version #{version}") else - Builtins.y2milestone("AutoYaST Profile Version %1 Detected.", version) + log.info("AutoYaST Profile Version #{version} detected.") end end @@ -216,11 +281,12 @@ # @param [Hash{String => Object}] profile # @return [void] def Import(profile) + log.info("importing profile") + profile = deep_copy(profile) - Builtins.y2milestone("importing profile") - @current = deep_copy(profile) + @current = Yast::ProfileHash.new(profile) - check_version(Ops.get_map(@current, "properties", {})) + check_version(@current.fetch_as_hash("properties")) # old style if Builtins.haskey(profile, "configure") || @@ -243,9 +309,10 @@ merge_resource_aliases! generalCompat # compatibility to new language,keyboard and timezone (SL10.1) + @current = Yast::ProfileHash.new(@current) softwareCompat + log.info "Current Profile = #{@current}" - Builtins.y2debug("Current Profile=%1", @current) nil end @@ -608,7 +675,7 @@ # @param profile [Hash] Initial profile # @return [Hash] Modified profile def setElementByList(path, value, profile) - profile = deep_copy(profile) + profile = Yast::ProfileHash.new(profile) merge_element_by_list(path, value, profile) end @@ -659,8 +726,7 @@ private def add_autoyast_packages - @current["software"] ||= {} - @current["software"]["packages"] ||= [] + @current["software"]["packages"] = @current["software"].fetch_as_array("packages") @current["software"]["packages"] << needed_second_stage_packages @current["software"]["packages"].flatten!.uniq! end @@ -738,7 +804,7 @@ if remaining_path.empty? value elsif remaining_path.first.is_a?(::String) - merge_element_by_list(remaining_path, value, profile[current] || {}) + merge_element_by_list(remaining_path, value, profile[current] || Yast::ProfileHash.new) else merge_element_by_list(remaining_path, value, profile[current] || []) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/test/AutoinstFunctions_test.rb new/autoyast2-4.4.2/test/AutoinstFunctions_test.rb --- old/autoyast2-4.3.75/test/AutoinstFunctions_test.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/test/AutoinstFunctions_test.rb 2021-04-08 18:39:04.000000000 +0200 @@ -93,7 +93,7 @@ context "registration has not been defined in AY configuration file" do it "reports error to set registration" do - allow(Yast::Profile).to receive(:current).and_return({}) + allow(Yast::Profile).to receive(:current).and_return(Yast::ProfileHash.new) expect(subject.check_second_stage_environment).to( include("configuring the registration") ) @@ -132,7 +132,7 @@ "and such base product exists on media" do allow(Yast::Profile) .to receive(:current) - .and_return("software" => { "products" => [selected_name] }) + .and_return(Yast::ProfileHash.new("software" => { "products" => [selected_name] })) expect(subject.selected_product.name).to eql selected_name end @@ -141,7 +141,9 @@ "such base product doesn't exist on media" do allow(Yast::Profile) .to receive(:current) - .and_return("software" => { "products" => { "product" => "Fedora" } }) + .and_return( + Yast::ProfileHash.new("software" => { "products" => { "product" => "Fedora" } }) + ) expect(subject.selected_product).to be nil end @@ -150,7 +152,7 @@ "if such base product exists on media" do allow(Yast::Profile) .to receive(:current) - .and_return("software" => { "patterns" => ["sles-base-32bit"] }) + .and_return(Yast::ProfileHash.new("software" => { "patterns" => ["sles-base-32bit"] })) expect(subject.selected_product.name).to eql selected_name end @@ -159,7 +161,7 @@ "if such base product exists on media" do allow(Yast::Profile) .to receive(:current) - .and_return("software" => { "packages" => ["sles-release"] }) + .and_return(Yast::ProfileHash.new("software" => { "packages" => ["sles-release"] })) expect(subject.selected_product.name).to eql selected_name end @@ -171,7 +173,7 @@ .and_return(double(available_base_products: [base_product("SLED")])) allow(Yast::Profile) .to receive(:current) - .and_return("software" => {}) + .and_return(Yast::ProfileHash.new("software" => {})) expect(subject.selected_product.name).to eql "SLED" end @@ -180,7 +182,7 @@ before do allow(Yast::Profile) .to receive(:current) - .and_return("software" => nil) + .and_return(Yast::ProfileHash.new("software" => nil)) end it "returns nil" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/test/AutoinstScripts_test.rb new/autoyast2-4.4.2/test/AutoinstScripts_test.rb --- old/autoyast2-4.3.75/test/AutoinstScripts_test.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/test/AutoinstScripts_test.rb 2021-04-08 18:39:04.000000000 +0200 @@ -2,6 +2,7 @@ require_relative "test_helper" +Yast.import "Profile" Yast.import "AutoinstScripts" describe "Yast::AutoinstScripts" do @@ -35,10 +36,12 @@ shared_examples "resolve location" do # this examples expect to have defined type and key it "strip white spaces from location" do - data = { key => [ - { "location" => "https://test.com/script \n \t " }, - { "location" => "\n\t https://test.com/script2" } - ] } + data = Yast::ProfileHash.new( + key => [ + { "location" => "https://test.com/script \n \t " }, + { "location" => "\n\t https://test.com/script2" } + ] + ) expected = [ "https://test.com/script", "https://test.com/script2" @@ -54,10 +57,12 @@ end it "resolve relurl using autoyast profile url" do - data = { key => [ - { "location" => "https://test.com/script" }, - { "location" => "relurl://script2" } - ] } + data = Yast::ProfileHash.new( + key => [ + { "location" => "https://test.com/script" }, + { "location" => "relurl://script2" } + ] + ) expected = [ "https://test.com/script", "https://example.com/script2" @@ -76,10 +81,12 @@ end it "resolve relurl using ayrelurl from install.inf" do - data = { key => [ - { "location" => "https://test.com/script" }, - { "location" => "relurl://script2" } - ] } + data = Yast::ProfileHash.new( + key => [ + { "location" => "https://test.com/script" }, + { "location" => "relurl://script2" } + ] + ) expected = ["https://test.com/script", "https://example2.com/ay/script2"] subject.Import(data) @@ -121,11 +128,11 @@ describe "#Export" do it "returns hash with defined scripts" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/new_script", "param-list" => [], "filename" => "script4", "source" => "", "interpreter" => "perl", "rerun" => false, "debug" => false, "feedback" => false, "feedback_type" => "", "notification" => "" }] - } + ) subject.Import(data) expect(subject.Export).to eq data @@ -134,11 +141,11 @@ describe "#Summary" do it "returns richtext string with scripts summary" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script" }], "post-scripts" => [{ "location" => "http://test.com/script2" }, { "location" => "http://test.com/script3" }] - } + ) subject.Import(data) expect(subject.Summary).to be_a(::String) @@ -148,11 +155,11 @@ describe "#AddEditScript" do context "given filename exists" do it "edits existing one" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1" }], "post-scripts" => [{ "location" => "http://test.com/script2", "filename" => "script2" }, { "location" => "http://test.com/script3", "filename" => "script3" }] - } + ) subject.Import(data) @@ -170,11 +177,11 @@ context "given filename does not exist" do it "adds new one to merged" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1" }], "post-scripts" => [{ "location" => "http://test.com/script2", "filename" => "script2" }, { "location" => "http://test.com/script3", "filename" => "script3" }] - } + ) subject.Import(data) @@ -193,11 +200,11 @@ describe "#deleteScript" do it "removes script with given filename from merged list" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1" }], "post-scripts" => [{ "location" => "http://test.com/script2", "filename" => "script2" }, { "location" => "http://test.com/script3", "filename" => "script3" }] - } + ) subject.Import(data) @@ -230,9 +237,9 @@ context "for pre-scripts" do it "downloads script from location if defined" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1" }] - } + ) expect_any_instance_of(Yast::Transfer::FileFromUrl).to( receive(:get_file_from_url) do |_klass, map| @@ -250,10 +257,10 @@ end it "creates script file from source if location not defined" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "source" => "echo krucifix > /home/dabel/body", "filename" => "script1" }] - } + ) expect(Yast::SCR).to receive(:Write).with(path(".target.string"), /pre-scripts\/script1$/, "echo krucifix > /home/dabel/body") @@ -283,10 +290,10 @@ context "for postpartitioning-scripts" do it "downloads script from location if defined" do - data = { + data = Yast::ProfileHash.new( "postpartitioning-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1" }] - } + ) expect_any_instance_of(Yast::Transfer::FileFromUrl).to( receive(:get_file_from_url) do |_klass, map| @@ -304,10 +311,10 @@ end it "creates script file from source if location not defined" do - data = { + data = Yast::ProfileHash.new( "postpartitioning-scripts" => [{ "source" => "echo krucifix > /home/dabel/body", "filename" => "script1" }] - } + ) expect(Yast::SCR).to receive(:Write).with(path(".target.string"), /script1$/, "echo krucifix > /home/dabel/body") @@ -319,9 +326,9 @@ context "for init-scripts" do it "downloads script from location if defined" do - data = { + data = Yast::ProfileHash.new( "init-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1" }] - } + ) expect_any_instance_of(Yast::Transfer::FileFromUrl).to( receive(:get_file_from_url) do |_klass, map| @@ -339,10 +346,10 @@ end it "creates script file from source if location not defined" do - data = { + data = Yast::ProfileHash.new( "init-scripts" => [{ "source" => "echo krucifix > /home/dabel/body", "filename" => "script1" }] - } + ) expect(Yast::SCR).to receive(:Write).with(path(".target.string"), "/var/adm/autoinstall/init.d/script1", "echo krucifix > /home/dabel/body") @@ -353,10 +360,10 @@ end it "executes script" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1", "interpreter" => "shell", "rerun" => true }] - } + ) expect(Yast::SCR).to receive(:Execute).with(path(".target.bash"), /\/bin\/sh/) @@ -365,10 +372,10 @@ end it "shows a feedback during script when notification is set for script" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1", "interpreter" => "shell", "rerun" => true, "notification" => "Script1!!!" }] - } + ) expect(Yast::Popup).to receive(:ShowFeedback).with("", "Script1!!!") expect(Yast::Popup).to receive(:ClearFeedback) @@ -378,10 +385,10 @@ end it "shows a report if feedback parameter is set" do - data = { + data = Yast::ProfileHash.new( "pre-scripts" => [{ "location" => "http://test.com/script", "filename" => "script1", "interpreter" => "shell", "feedback" => true, "feedback_type" => "error", "rerun" => true }] - } + ) allow(Yast::SCR).to receive(:Read).and_return("test") expect(Yast::Report).to receive(:Error) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/test/lib/autosetup_helpers_test.rb new/autoyast2-4.4.2/test/lib/autosetup_helpers_test.rb --- old/autoyast2-4.3.75/test/lib/autosetup_helpers_test.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/test/lib/autosetup_helpers_test.rb 2021-04-08 18:39:04.000000000 +0200 @@ -54,7 +54,7 @@ end describe "#suse_register" do - let(:profile_content) { { "general" => {} } } + let(:profile_content) { Yast::ProfileHash.new("general" => {}) } let(:reg_module_available) { true } before do @@ -86,7 +86,9 @@ end context "suse_register tag is defined in AY file" do - let(:profile_content) { { "suse_register" => { "reg_code" => "12345" } } } + let(:profile_content) do + Yast::ProfileHash.new("suse_register" => { "reg_code" => "12345" }) + end before do allow(Yast::WFM).to receive(:CallFunction).with("inst_download_release_notes") @@ -130,7 +132,9 @@ end context "semi-automatic is defined in AY file" do - let(:profile_content) { { "general" => { "semi-automatic" => ["scc"] } } } + let(:profile_content) do + Yast::ProfileHash.new("general" => { "semi-automatic" => ["scc"] }) + end it "shows registration screen mask and returns true" do # Showing registration screen mask expect(Yast::WFM).to receive(:CallFunction).with("inst_scc", @@ -243,7 +247,7 @@ end describe "#autosetup_firewall" do - let(:profile) { { "firewall" => firewall_section } } + let(:profile) { Yast::ProfileHash.new("firewall" => firewall_section) } let(:firewall_section) { { "default_zone" => "external" } } before(:each) do @@ -284,7 +288,7 @@ end describe "#autosetup_network" do - let(:profile) { networking_section } + let(:profile) { Yast::ProfileHash.new(networking_section) } let(:networking_section) { { "networking" => { "setup_before_proposal" => true } } } let(:host_section) { { "host" => { "hosts" => [] } } } @@ -311,7 +315,7 @@ end context "and the setup is defined to be run before the proposal" do - let(:profile) { networking_section.merge(host_section) } + let(:profile) { Yast::ProfileHash.new(networking_section.merge(host_section)) } let(:networking_section) { { "networking" => { "setup_before_proposal" => true } } } context "and a host section is defined" do @@ -372,7 +376,7 @@ end describe "#semi_auto?" do - let(:profile) { general_section } + let(:profile) { Yast::ProfileHash.new(general_section) } let(:general_section) { { "general" => { "semi-automatic" => ["networking"] } } } before do @@ -391,7 +395,9 @@ end describe "#autosetup_country" do - let(:profile) { language_section.merge(timezone_section).merge(keyboard_section) } + let(:profile) do + Yast::ProfileHash.new(language_section.merge(timezone_section).merge(keyboard_section)) + end let(:language_section) { { "language" => { "language" => "de_DE", "languages" => "es_ES" } } } let(:timezone_section) { {} } let(:keyboard_section) { {} } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/test/lib/clients/inst_autoinit_test.rb new/autoyast2-4.4.2/test/lib/clients/inst_autoinit_test.rb --- old/autoyast2-4.3.75/test/lib/clients/inst_autoinit_test.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/test/lib/clients/inst_autoinit_test.rb 2021-04-08 18:39:04.000000000 +0200 @@ -32,7 +32,7 @@ allow(Yast::Linuxrc).to receive(:InstallInf).and_return(nil) allow(Yast::ProfileLocation).to receive(:Process).and_return(true) allow(Yast::Profile).to receive(:ReadXML).and_return(true) - allow(Yast::Profile).to receive(:current).and_return({}) + allow(Yast::Profile).to receive(:current).and_return(Yast::ProfileHash.new) allow(Yast::Mode).to receive(:autoupgrade).and_return(true) allow(Yast::AutoinstFunctions).to receive(:available_base_products).and_return([]) allow(Y2Packager::MediumType).to receive(:online?).and_return(true) @@ -79,7 +79,8 @@ it "calls iscsci client import and write if profile contain it" do map = { "enabled" => false } - allow(Yast::Profile).to receive(:current).and_return("iscsi-client" => map) + allow(Yast::Profile).to receive(:current) + .and_return(Yast::ProfileHash.new("iscsi-client" => map)) expect(Yast::WFM).to receive(:CallFunction).with("iscsi-client_auto", ["Import", map]) expect(Yast::WFM).to receive(:CallFunction).with("iscsi-client_auto", ["Write"]) @@ -88,7 +89,8 @@ it "calls fcoe client import and write if profile contain it" do map = { "enabled" => false } - allow(Yast::Profile).to receive(:current).and_return("fcoe-client" => map) + allow(Yast::Profile).to receive(:current) + .and_return(Yast::ProfileHash.new("fcoe-client" => map)) expect(Yast::WFM).to receive(:CallFunction).with("fcoe-client_auto", ["Import", map]) expect(Yast::WFM).to receive(:CallFunction).with("fcoe-client_auto", ["Write"]) @@ -111,10 +113,10 @@ let(:do_registration) { false } let(:setup_before_proposal) { false } let(:profile) do - { + Yast::ProfileHash.new( "suse_register" => { "do_registration" => do_registration }, "networking" => { "setup_before_proposal" => setup_before_proposal } - } + ) end before do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/test/lib/clients/inst_autosetup_test.rb new/autoyast2-4.4.2/test/lib/clients/inst_autosetup_test.rb --- old/autoyast2-4.3.75/test/lib/clients/inst_autosetup_test.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/test/lib/clients/inst_autosetup_test.rb 2021-04-08 18:39:04.000000000 +0200 @@ -59,7 +59,7 @@ allow(subject).to receive(:probe_storage) allow(Yast::AutoinstSoftware).to receive(:Write).and_return(true) allow(Yast::ServicesManager).to receive(:import) - Yast::Profile.current = profile + Yast::Profile.current = Yast::ProfileHash.new(profile) end it "sets up the network" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/test/lib/pkg_gpg_check_handler_test.rb new/autoyast2-4.4.2/test/lib/pkg_gpg_check_handler_test.rb --- old/autoyast2-4.3.75/test/lib/pkg_gpg_check_handler_test.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/test/lib/pkg_gpg_check_handler_test.rb 2021-04-08 18:39:04.000000000 +0200 @@ -5,17 +5,23 @@ require "yast" +Yast.import "Profile" + describe Yast::PkgGpgCheckHandler do subject(:handler) { Yast::PkgGpgCheckHandler.new(data, profile) } let(:data) do - { "CheckPackageResult" => result, + Yast::ProfileHash.new( + "CheckPackageResult" => result, "Package" => "dummy-package", "Localpath" => "/path/to/dummy-package.rpm", - "RepoMediaUrl" => "http://dl.opensuse.org/repos/YaST:/Head" } + "RepoMediaUrl" => "http://dl.opensuse.org/repos/YaST:/Head" + ) end let(:result) { Yast::PkgGpgCheckHandler::CHK_OK } - let(:profile) { { "general" => { "signature-handling" => signature_handling } } } + let(:profile) do + Yast::ProfileHash.new("general" => { "signature-handling" => signature_handling }) + end let(:signature_handling) { {} } describe "#accept?" do @@ -265,19 +271,23 @@ let(:result) { Yast::PkgGpgCheckHandler::CHK_NOTFOUND } let(:profile) do - { "general" => { - "signature-handling" => { - "accept_unsigned_file" => true, - "accept_unknown_gpg_key" => true - } - }, + Yast::ProfileHash.new( + "general" => { + "signature-handling" => { + "accept_unsigned_file" => true, + "accept_unknown_gpg_key" => true + } + }, "add-on" => { "add_on_products" => [ - { "media_url" => "http://dl.opensuse.org/repos/YaST:/Head", + Yast::ProfileHash.new( + "media_url" => "http://dl.opensuse.org/repos/YaST:/Head", "name" => "yast_head", - "signature-handling" => { "accept_unsigned_file" => false } } + "signature-handling" => { "accept_unsigned_file" => false } + ) ] - } } + } + ) end it "honors the add-on settings" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-4.3.75/test/profile_test.rb new/autoyast2-4.4.2/test/profile_test.rb --- old/autoyast2-4.3.75/test/profile_test.rb 2021-03-18 10:32:19.000000000 +0100 +++ new/autoyast2-4.4.2/test/profile_test.rb 2021-04-08 18:39:04.000000000 +0200 @@ -38,7 +38,7 @@ let(:second_stage_required) { true } context "when autoyast2-installation is not selected to be installed" do - let(:profile) { { "software" => { "packages" => [] } } } + let(:profile) { Yast::ProfileHash.new("software" => { "packages" => [] }) } context "and second stage is required" do it "adds 'autoyast2-installation' to packages list" do @@ -58,8 +58,10 @@ context "and second stage is disabled on the profile itself" do let(:profile) do - { "general" => { "mode" => { "second_stage" => false } }, - "software" => { "packages" => [] } } + Yast::ProfileHash.new( + "general" => { "mode" => { "second_stage" => false } }, + "software" => { "packages" => [] } + ) end it "does not add 'autoyast2-installation' to packages list" do @@ -70,7 +72,7 @@ end context "when some section handled by a client included in autoyast2 package is present" do - let(:profile) { { "scripts" => [] } } + let(:profile) { Yast::ProfileHash.new("scripts" => []) } context "and second stage is required" do it "adds 'autoyast2' to packages list" do @@ -90,8 +92,10 @@ context "and second stage is disabled on the profile itself" do let(:profile) do - { "general" => { "mode" => { "second_stage" => false } }, - "files" => [] } + Yast::ProfileHash.new( + "general" => { "mode" => { "second_stage" => false } }, + "files" => [] + ) end it "does not add 'autoyast2' to packages list" do @@ -102,7 +106,7 @@ end context "when the software patterns section is empty" do - let(:profile) { { "software" => { "patterns" => [] } } } + let(:profile) { Yast::ProfileHash.new("software" => { "patterns" => [] }) } it "adds 'base' pattern" do Yast::Profile.softwareCompat @@ -111,7 +115,7 @@ end context "when the software patterns section is missing" do - let(:profile) { {} } + let(:profile) { Yast::ProfileHash.new } it "adds 'base' pattern" do Yast::Profile.softwareCompat @@ -121,11 +125,11 @@ end describe "#Import" do - let(:profile) { {} } + let(:profile) { Yast::ProfileHash.new } context "when profile is given in the old format" do context "and 'install' key is present" do - let(:profile) { { "install" => { "section1" => ["val1"] } } } + let(:profile) { Yast::ProfileHash.new("install" => { "section1" => ["val1"] }) } it "move 'install' items to the root of the profile" do Yast::Profile.Import(profile) @@ -135,7 +139,7 @@ end context "and 'configure' key is present" do - let(:profile) { { "configure" => { "section2" => ["val2"] } } } + let(:profile) { Yast::ProfileHash.new("configure" => { "section2" => ["val2"] }) } it "move 'configure' items to the root of the profile" do Yast::Profile.Import(profile) @@ -146,8 +150,10 @@ context "when both keys are present" do let(:profile) do - { "configure" => { "section2" => ["val2"] }, - "install" => { "section1" => ["val1"] } } + Yast::ProfileHash.new( + "configure" => { "section2" => ["val2"] }, + "install" => { "section1" => ["val1"] } + ) end it "merge them into the root of the profile" do @@ -161,8 +167,10 @@ context "when both keys are present and some section is duplicated" do let(:profile) do - { "configure" => { "section1" => "val3", "section2" => ["val2"] }, - "install" => { "section1" => ["val1"] } } + Yast::ProfileHash.new( + "configure" => { "section1" => "val3", "section2" => ["val2"] }, + "install" => { "section1" => ["val1"] } + ) end it "merges them into the root of the profile giving precedence to 'installation' section" do