diff --git a/service/lib/agama/storage/config_conversions.rb b/service/lib/agama/storage/config_conversions.rb index 17ff47ee9..e8f49d38f 100644 --- a/service/lib/agama/storage/config_conversions.rb +++ b/service/lib/agama/storage/config_conversions.rb @@ -26,9 +26,6 @@ module Agama module Storage # Conversions for the storage config. module ConfigConversions - # Reserved string for Configs::Search meaning 'match all devices if there is any' - SEARCH_ANYTHING_STRING = "*" - private_constant :SEARCH_ANYTHING_STRING end end end diff --git a/service/lib/agama/storage/config_conversions/from_json_conversions/search.rb b/service/lib/agama/storage/config_conversions/from_json_conversions/search.rb index 7b372f55d..e742de66a 100644 --- a/service/lib/agama/storage/config_conversions/from_json_conversions/search.rb +++ b/service/lib/agama/storage/config_conversions/from_json_conversions/search.rb @@ -36,6 +36,12 @@ def convert private + # Reserved search value meaning 'match all devices or ignore the section'. + # + # { search: "*" } is a shortcut for { search: { ifNotFound: "skip" } }. + SEARCH_ANYTHING_STRING = "*" + private_constant :SEARCH_ANYTHING_STRING + alias_method :search_json, :config_json # @see Base#conversions diff --git a/service/lib/agama/storage/config_conversions/to_json_conversions/search.rb b/service/lib/agama/storage/config_conversions/to_json_conversions/search.rb index 9cc21417f..957392e25 100644 --- a/service/lib/agama/storage/config_conversions/to_json_conversions/search.rb +++ b/service/lib/agama/storage/config_conversions/to_json_conversions/search.rb @@ -33,13 +33,6 @@ def self.config_type Configs::Search end - # @see Base#convert - def convert - return SEARCH_ANYTHING_STRING if config.all_if_any? - - super - end - private # @see Base#conversions diff --git a/service/lib/agama/storage/configs/search.rb b/service/lib/agama/storage/configs/search.rb index 6066ec9bb..abc826b9d 100644 --- a/service/lib/agama/storage/configs/search.rb +++ b/service/lib/agama/storage/configs/search.rb @@ -71,13 +71,6 @@ def always_match? name.nil? end - # Whether the search matches all the available devices, skipping if none is found - # - # @return [Boolean] - def all_if_any? - always_match? && max.nil? && if_not_found == :skip - end - # Whether the section containing the search should be skipped # # @return [Boolean] diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index e92f3ce3d..10295b28f 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Oct 30 11:33:54 UTC 2024 - José Iván López González + +- Storage: do not generate config json with search wildcard + (gh#agama-project/agama#1713). +- Storage: fix issue when setting config + (gh#agama-project/agama#1706). + ------------------------------------------------------------------- Thu Oct 24 14:44:35 UTC 2024 - Ancor Gonzalez Sosa @@ -21,7 +29,7 @@ Wed Oct 16 15:09:31 UTC 2024 - Imobach Gonzalez Sosa - Add support for running user-defined scripts after the installation (gh#agama-project/agama#1673). - + ------------------------------------------------------------------- Wed Oct 16 14:35:47 UTC 2024 - José Iván López González diff --git a/service/test/agama/storage/config_conversions/to_json_test.rb b/service/test/agama/storage/config_conversions/to_json_test.rb index 977c0f5f1..4b6b9d106 100644 --- a/service/test/agama/storage/config_conversions/to_json_test.rb +++ b/service/test/agama/storage/config_conversions/to_json_test.rb @@ -150,11 +150,15 @@ context "if there are no conditions or limits and errors should be skipped" do let(:search) { { ifNotFound: "skip" } } - it "generates a wildcard" do + it "generates the expected JSON" do config_json = result_scope.call(subject.convert) search_json = config_json[:search] - expect(search_json).to eq "*" + expect(search_json).to eq( + { + ifNotFound: "skip" + } + ) end end end