Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions service/lib/agama/storage/config_conversions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions service/lib/agama/storage/configs/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 9 additions & 1 deletion service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Oct 30 11:33:54 UTC 2024 - José Iván López González <jlopez@suse.com>

- 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 <ancor@suse.com>

Expand All @@ -21,7 +29,7 @@ Wed Oct 16 15:09:31 UTC 2024 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- 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 <jlopez@suse.com>

Expand Down
8 changes: 6 additions & 2 deletions service/test/agama/storage/config_conversions/to_json_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down