Hello community, here is the log from the commit of package autoyast2 for openSUSE:Factory checked in at 2016-11-19 12:49:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/autoyast2 (Old) and /work/SRC/openSUSE:Factory/.autoyast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "autoyast2" Changes: -------- --- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes 2016-11-12 12:59:48.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.autoyast2.new/autoyast2.changes 2016-11-19 12:49:38.000000000 +0100 @@ -1,0 +2,24 @@ +Fri Nov 18 10:00:25 UTC 2016 - [email protected] + +- Do not crash when services manager configuration is missing + (related to bsc#887115) +- 3.2.3 + +------------------------------------------------------------------- +Wed Nov 16 14:45:24 UTC 2016 - [email protected] + +- Hiding a module in its .desktop file (Hidden=true) won't prevent + it from being cloned anymore (bsc#1008301) +- Add support to specify resource aliases using the key + X-SuSE-YaST-AutoInstResourceAliases in desktop files (related + to bsc#887115) +- 3.2.2 + +------------------------------------------------------------------- +Wed Nov 16 15:12:43 CET 2016 - [email protected] + +- Do not check certificate for images which have been created by + the user/customer. Found while testing bnc#1009023. +- 3.2.1 + +------------------------------------------------------------------- Old: ---- autoyast2-3.2.0.tar.bz2 New: ---- autoyast2-3.2.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ autoyast2.spec ++++++ --- /var/tmp/diff_new_pack.MKSRMT/_old 2016-11-19 12:49:39.000000000 +0100 +++ /var/tmp/diff_new_pack.MKSRMT/_new 2016-11-19 12:49:39.000000000 +0100 @@ -17,7 +17,7 @@ Name: autoyast2 -Version: 3.2.0 +Version: 3.2.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -94,8 +94,8 @@ Requires: yast2-ruby-bindings >= 1.0.0 Summary: YaST2 - Auto Installation Modules -Group: System/YaST # API for Disabled Modules (ProductControl) +Group: System/YaST Requires: yast2 >= 2.16.36 # After API cleanup Requires: yast2 ++++++ autoyast2-3.2.0.tar.bz2 -> autoyast2-3.2.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/package/autoyast2.changes new/autoyast2-3.2.3/package/autoyast2.changes --- old/autoyast2-3.2.0/package/autoyast2.changes 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/package/autoyast2.changes 2016-11-18 12:04:15.000000000 +0100 @@ -1,4 +1,28 @@ ------------------------------------------------------------------- +Fri Nov 18 10:00:25 UTC 2016 - [email protected] + +- Do not crash when services manager configuration is missing + (related to bsc#887115) +- 3.2.3 + +------------------------------------------------------------------- +Wed Nov 16 14:45:24 UTC 2016 - [email protected] + +- Hiding a module in its .desktop file (Hidden=true) won't prevent + it from being cloned anymore (bsc#1008301) +- Add support to specify resource aliases using the key + X-SuSE-YaST-AutoInstResourceAliases in desktop files (related + to bsc#887115) +- 3.2.2 + +------------------------------------------------------------------- +Wed Nov 16 15:12:43 CET 2016 - [email protected] + +- Do not check certificate for images which have been created by + the user/customer. Found while testing bnc#1009023. +- 3.2.1 + +------------------------------------------------------------------- Mon Oct 24 09:04:25 UTC 2016 - [email protected] - Add support to enable copy-on-write for Btrfs subvolumes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/package/autoyast2.spec new/autoyast2-3.2.3/package/autoyast2.spec --- old/autoyast2-3.2.0/package/autoyast2.spec 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/package/autoyast2.spec 2016-11-18 12:04:15.000000000 +0100 @@ -17,7 +17,7 @@ Name: autoyast2 -Version: 3.2.0 +Version: 3.2.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/src/bin/fetch_image.sh new/autoyast2-3.2.3/src/bin/fetch_image.sh --- old/autoyast2-3.2.0/src/bin/fetch_image.sh 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/src/bin/fetch_image.sh 2016-11-18 12:04:15.000000000 +0100 @@ -17,7 +17,7 @@ case "$LOCATION" in # catch http, https, ftp and tftp http:*|https:*|ftp:*|tftp:*) - wget -O - $LOCATION 2>/dev/null | tar xfz - -C /mnt + wget --no-check-certificate -O - $LOCATION 2>/dev/null | tar xfz - -C /mnt ;; nfs:*) # FIXME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/src/modules/Profile.rb new/autoyast2-3.2.3/src/modules/Profile.rb --- old/autoyast2-3.2.0/src/modules/Profile.rb 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/src/modules/Profile.rb 2016-11-18 12:04:15.000000000 +0100 @@ -301,8 +301,6 @@ end end - - # Import Profile # @param [Hash{String => Object}] profile # @return [void] @@ -345,6 +343,7 @@ Ops.set(@current, ["networking", "start_immediately"], true) Builtins.y2milestone("start_immediately set to true") end + merge_resource_aliases! storageLibCompat # compatibility to new storage library (SL 10.0) generalCompat # compatibility to new language,keyboard and timezone (SL10.1) softwareCompat @@ -367,9 +366,6 @@ e = [] Builtins.foreach(@ModuleMap) do |p, d| - # bnc#887115 Hidden modules cannot be cloned - next if d["Hidden"] == "true" - # # Set resource name, if not using default value # @@ -913,6 +909,42 @@ end end + protected + + # Merge resource aliases in the profile + # + # When a resource is aliased, the configuration with the aliased name will + # be renamed to the new name. For example, if we have a + # services-manager.desktop file containing + # X-SuSE-YaST-AutoInstResourceAliases=runlevel, if a "runlevel" key is found + # in the profile, it will be renamed to "services-manager". + # + # The rename won't take place if a "services-manager" resource already exists. + # + # @see merge_aliases_map + def merge_resource_aliases! + resource_aliases_map.each do |alias_name, resource_name| + aliased_config = current.delete(alias_name) + next if aliased_config.nil? || current.has_key?(resource_name) + current[resource_name] = aliased_config + end + end + + # Module aliases map + # + # This method delegates on Y2ModuleConfig#resource_aliases_map + # and exists just to avoid a circular dependency between + # Y2ModuleConfig and Profile (as the former depends on the latter). + # + # @return [Hash] Map of resource aliases where the key is the alias and the + # value is the resource ({alias => resource}) + # + # @see Y2ModuleConfig#resource_aliases_map + def resource_aliases_map + Yast.import "Y2ModuleConfig" + Y2ModuleConfig.resource_aliases_map + end + publish :variable => :current, :type => "map <string, any>" publish :variable => :ModuleMap, :type => "map <string, map>" publish :variable => :changed, :type => "boolean" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/src/modules/Y2ModuleConfig.rb new/autoyast2-3.2.3/src/modules/Y2ModuleConfig.rb --- old/autoyast2-3.2.0/src/modules/Y2ModuleConfig.rb 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/src/modules/Y2ModuleConfig.rb 2016-11-18 12:04:15.000000000 +0100 @@ -13,6 +13,7 @@ # Key for AutoYaST client name in desktop file RESOURCE_NAME_KEY = "X-SuSE-YaST-AutoInstResource" RESOURCE_NAME_MERGE_KEYS = "X-SuSE-YaST-AutoInstMerge" + RESOURCE_ALIASES_NAME_KEY = "X-SuSE-YaST-AutoInstResourceAliases" MODES = %w(all configure write) include Yast::Logger @@ -52,6 +53,7 @@ "Hidden", "X-SuSE-YaST-AutoInst", RESOURCE_NAME_KEY, + RESOURCE_ALIASES_NAME_KEY, "X-SuSE-YaST-AutoInstClient", "X-SuSE-YaST-Group", RESOURCE_NAME_MERGE_KEYS, @@ -402,6 +404,20 @@ end end + # Module aliases map + # + # @return [Hash] Map of resource aliases where the key is the alias and the + # value is the resource ({alias => resource}) + def resource_aliases_map + ModuleMap().each_with_object({}) do |resource, map| + name, def_resource = resource + next if def_resource[RESOURCE_ALIASES_NAME_KEY].nil? + resource_name = def_resource[RESOURCE_NAME_KEY] || name + aliases = def_resource[RESOURCE_ALIASES_NAME_KEY].split(",").map(&:strip) + aliases.each { |a| map[a] = resource_name } + end + end + publish :variable => :GroupMap, :type => "map <string, map>" publish :variable => :ModuleMap, :type => "map <string, map>" publish :variable => :MenuTreeData, :type => "list <map>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/test/AutoinstGeneral_test.rb new/autoyast2-3.2.3/test/AutoinstGeneral_test.rb --- old/autoyast2-3.2.0/test/AutoinstGeneral_test.rb 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/test/AutoinstGeneral_test.rb 2016-11-18 12:04:15.000000000 +0100 @@ -15,6 +15,7 @@ end before do + allow(Yast).to receive(:import).and_call_original allow(Yast).to receive(:import).with("FileSystems").and_return(nil) stub_const("Yast::FileSystems", filesystems) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/test/Y2ModuleConfig_test.rb new/autoyast2-3.2.3/test/Y2ModuleConfig_test.rb --- old/autoyast2-3.2.0/test/Y2ModuleConfig_test.rb 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/test/Y2ModuleConfig_test.rb 2016-11-18 12:04:15.000000000 +0100 @@ -32,20 +32,20 @@ allow(Yast::WFM).to receive(:ClientExists).with("partitioning_auto").and_return(false) allow(Yast::WFM).to receive(:ClientExists).with("upgrade_auto").and_return(false) allow(Yast::WFM).to receive(:ClientExists).with("cobbler_auto").and_return(false) + allow(Yast::WFM).to receive(:ClientExists).with("services-manager_auto").and_return(true) end describe "#unhandled_profile_sections" do let(:profile_unhandled) { File.join(FIXTURES_PATH, 'profiles', 'unhandled_and_obsolete.xml') } it "returns all unsupported and unknown profile sections" do - Yast::Profile.ReadXML(profile_unhandled) Yast::Y2ModuleConfig.instance_variable_set("@ModuleMap", DESKTOP_DATA) + Yast::Profile.ReadXML(profile_unhandled) expect(Yast::Y2ModuleConfig.unhandled_profile_sections.sort).to eq( [ "audit-laf", "autofs", "ca_mgm", "cobbler", "firstboot", "language", "restore", - "runlevel", "sshd", "sysconfig", "unknown_profile_item_1", - "unknown_profile_item_2" + "sshd", "sysconfig", "unknown_profile_item_1", "unknown_profile_item_2" ].sort ) end @@ -93,4 +93,47 @@ end end end + + describe "#resource_aliases_map" do + let(:module_map) { { "custom" => custom_module } } + + before do + allow(subject).to receive(:ModuleMap).and_return(module_map) + end + + context "when some module is aliased" do + let(:custom_module) do + { "Name" => "Custom module", + "X-SuSE-YaST-AutoInstResourceAliases" => "alias1,alias2" } + end + + it "maps aliases to the resource" do + expect(subject.resource_aliases_map) + .to eq({ "alias1" => "custom", "alias2" => "custom" }) + end + end + + context "when some module is aliased and an alternative name was specified" do + let(:custom_module) do + { "Name" => "Custom module", + "X-SuSE-YaST-AutoInstResource" => "custom-resource", + "X-SuSE-YaST-AutoInstResourceAliases" => "alias1,alias2" } + end + + it "maps aliases to the alternative resource name" do + expect(subject.resource_aliases_map) + .to eq({ "alias1" => "custom-resource", "alias2" => "custom-resource" }) + end + end + + context "when no module is aliased" do + let(:custom_module) do + { "Name" => "Custom module" } + end + + it "returns an empty map" do + expect(subject.resource_aliases_map).to eq({}) + end + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/test/fixtures/desktop_files/desktops.yml new/autoyast2-3.2.3/test/fixtures/desktop_files/desktops.yml --- old/autoyast2-3.2.0/test/fixtures/desktop_files/desktops.yml 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/test/fixtures/desktop_files/desktops.yml 2016-11-18 12:04:15.000000000 +0100 @@ -66,3 +66,8 @@ GenericName: Configure secure defaults X-SuSE-YaST-AutoInst: all X-SuSE-YaST-AutoInstClient: security_auto +services-manager: + X-SuSE-YaST-Group: System + X-SuSE-YaST-AutoInst: all + X-SuSE-YaST-AutoInstClonable: true + X-SuSE-YaST-AutoInstResourceAliases: runlevel \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.2.0/test/profile_test.rb new/autoyast2-3.2.3/test/profile_test.rb --- old/autoyast2-3.2.0/test/profile_test.rb 2016-11-11 15:12:47.000000000 +0100 +++ new/autoyast2-3.2.3/test/profile_test.rb 2016-11-18 12:04:15.000000000 +0100 @@ -3,8 +3,17 @@ require_relative "test_helper" Yast.import "Profile" +Yast.import "Y2ModuleConfig" +Yast.import "AutoinstClone" describe Yast::Profile do + CUSTOM_MODULE = { + "Name" => "Custom module", + "X-SuSE-YaST-AutoInst" => "configure", + "X-SuSE-YaST-Group" => "System", + "X-SuSE-YaST-AutoInstClient" => "custom_auto" + } + subject { Yast::Profile } def items_list(items) @@ -179,6 +188,78 @@ expect(Yast::Profile).to receive(:softwareCompat) Yast::Profile.Import(profile) end + + context "when the profile contains an aliased resource" do + let(:custom_module) do + CUSTOM_MODULE.merge( + "X-SuSE-YaST-AutoInstResourceAliases" => "old_custom" + ) + end + + before do + allow(Yast::Y2ModuleConfig).to receive(:ModuleMap) + .and_return("custom" => custom_module) + end + + context "and configuration for the resource is missing" do + let(:profile) { { "old_custom" => { "dummy" => true } } } + + it "reuses the aliased configuration" do + Yast::Profile.Import(profile) + expect(Yast::Profile.current.keys).to_not include("old_custom") + expect(Yast::Profile.current["custom"]).to eq("dummy" => true) + end + end + + context "and configuration for the resource is present" do + let(:profile) { { "old_custom" => { "dummy" => true }, "custom" => { "dummy" => false } } } + + it "removes the aliased configuration" do + Yast::Profile.Import(profile) + expect(Yast::Profile.current.keys).to_not include("old_custom") + expect(Yast::Profile.current["custom"]).to eq("dummy" => false) + end + end + + context "and no configuration is present" do + let(:profile) { {} } + + it "does not set any configuration for the resource" do + Yast::Profile.Import(profile) + expect(Yast::Profile.current.keys).to_not include("old_custom") + expect(Yast::Profile.current.keys).to_not include("custom") + end + end + + context "and resource has also an alternate name" do + let(:profile) { { "old_custom" => { "dummy" => true } } } + let(:custom_module) do + CUSTOM_MODULE.merge( + "X-SuSE-YaST-AutoInstResource" => "new_custom", + "X-SuSE-YaST-AutoInstResourceAliases" => "old_custom" + ) + end + + it "uses the alternate name" do + Yast::Profile.Import(profile) + expect(Yast::Profile.current["new_custom"]).to eq("dummy" => true) + end + end + + context "and more than one aliased name is used" do + let(:profile) { { "other_alias" => { "dummy" => true } } } + let(:custom_module) do + CUSTOM_MODULE.merge( + "X-SuSE-YaST-AutoInstResourceAliases" => "other_alias,old_custom" + ) + end + + it "takes into account all aliases" do + Yast::Profile.Import(profile) + expect(Yast::Profile.current["custom"]).to eq("dummy" => true) + end + end + end end describe "#remove_sections" do @@ -202,4 +283,90 @@ end end end + + describe "#Prepare" do + let(:prepare) { true } + let(:general_module) do + { + "Name"=>"General Options", + "X-SuSE-YaST-AutoInst"=>"configure", + "X-SuSE-YaST-Group"=>"System", + "X-SuSE-YaST-AutoInstClient"=>"general_auto" + } + end + let(:custom_module) { CUSTOM_MODULE } + let(:custom_export) { { "key1" => "val1" } } + let(:module_map) { { "general" => general_module, "custom" => custom_module } } + + before do + allow(Yast::Y2ModuleConfig).to receive(:ReadMenuEntries) + .with(["all", "configure"]).and_return([module_map, {}]) + allow(Yast::WFM).to receive(:CallFunction).and_call_original + allow(Yast::WFM).to receive(:CallFunction) + .with("custom_auto", ["GetModified"]).and_return(true) + allow(Yast::WFM).to receive(:CallFunction) + .with("custom_auto", ["Export"]).and_return(custom_export) + allow(Yast::AutoinstClone).to receive(:General) + .and_return("mode" => { "confirm" => false}) + + Yast::Y2ModuleConfig.main + Yast.import "AutoinstClone" + Yast::AutoinstClone.Process + + subject.prepare = prepare + end + + it "exports modules data into the current profile" do + subject.Prepare + expect(subject.current["general"]).to be_kind_of(Hash) + expect(subject.current["custom"]).to be_kind_of(Hash) + end + + context "when preparation is not needed" do + let(:prepare) { false } + + it "does not set the current profile" do + subject.Reset + subject.Prepare + expect(subject.current).to be_empty + end + end + + context "when a module is 'hidden'" do + let(:custom_module) { CUSTOM_MODULE.merge("Hidden" => "true") } + + it "includes that module" do + subject.Prepare + expect(subject.current.keys).to include("custom") + end + end + + context "when a module has elements to merge" do + let(:custom_module) do + CUSTOM_MODULE.merge( + "X-SuSE-YaST-AutoInstClient" => "custom_auto", + "X-SuSE-YaST-AutoInstMerge" => "users,defaults", + "X-SuSE-YaST-AutoInstMergeTypes" => "list,map" + ) + end + + it "adds each element into the current profile" do + subject.Prepare + expect(subject.current["users"]).to be_kind_of(Array) + expect(subject.current["defaults"]).to be_kind_of(Hash) + end + end + + context "when a module uses an alternative resource name" do + let(:custom_module) do + CUSTOM_MODULE.merge("X-SuSE-YaST-AutoInstResource" => "alternative") + end + + it "uses the alternative name" do + subject.Prepare + expect(subject.current).to include("alternative") + expect(subject.current).to_not include("custom") + end + end + end end
