diff --git a/service/lib/agama/autoyast/profile_checker.rb b/service/lib/agama/autoyast/profile_checker.rb index 867f5e4950..34c6e88f5a 100644 --- a/service/lib/agama/autoyast/profile_checker.rb +++ b/service/lib/agama/autoyast/profile_checker.rb @@ -51,6 +51,8 @@ def elements_from(profile, parent = "") return [] unless profile.is_a?(Hash) profile.map do |k, v| + next if empty?(v) + current = parent.empty? ? k : "#{parent}#{ProfileDescription::SEPARATOR}#{k}" children = if v.is_a?(Array) @@ -62,7 +64,12 @@ def elements_from(profile, parent = "") end [current, *children] - end.flatten + end.flatten.compact + end + + # Determine whether the given value is empty. + def empty?(value) + value.nil? || (value.respond_to?(:empty?) && value.empty?) end end end diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index bff2d79d08..262ce65a5c 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Mar 10 14:10:18 UTC 2026 - Imobach Gonzalez Sosa + +- Do not report AutoYaST elements as unsupported if the value is empty + (bsc#1259458). + ------------------------------------------------------------------- Tue Feb 24 16:59:38 UTC 2026 - Ladislav Slezák diff --git a/service/test/agama/autoyast/profile_checker_test.rb b/service/test/agama/autoyast/profile_checker_test.rb index 703515afa4..7e2e272b51 100644 --- a/service/test/agama/autoyast/profile_checker_test.rb +++ b/service/test/agama/autoyast/profile_checker_test.rb @@ -34,11 +34,21 @@ end end - context "when an unsupported section is included" do + context "when an unsupported section with empty value is included" do let(:profile) do { "auth-client" => {} } end + it "ignores the unsupported element" do + expect(subject.find_unsupported(profile)).to eq([]) + end + end + + context "when an unsupported section is included" do + let(:profile) do + { "auth-client" => { "some" => "value" } } + end + it "returns an array with the unsupported element" do expect(subject.find_unsupported(profile)).to contain_exactly( an_object_having_attributes(key: "auth-client")