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
2 changes: 1 addition & 1 deletion service/lib/agama/cmdline_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def self.read_from(path)
options.split.each do |option|
next unless option.start_with?(CMDLINE_PREFIX)

key, value = option.split("=")
key, value = option.split("=", 2)
key.gsub!(CMDLINE_PREFIX, "")
# Omit config_url from Config options
next args.config_url = value if key == "config_url"
Expand Down
6 changes: 6 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Dec 3 20:32:08 UTC 2024 - Josef Reidinger <jreidinger@suse.com>

- Fix parsing agama.install_url that contain '='
(gh#agama-project/agama#1803)

-------------------------------------------------------------------
Tue Dec 3 16:43:08 UTC 2024 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
22 changes: 21 additions & 1 deletion service/test/agama/cmdline_args_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,28 @@
describe ".read_from" do
it "reads the kernel command line options and return a CmdlineArgs object" do
args = described_class.read_from(File.join(workdir, "/proc/cmdline"))
expect(args.data).to eql("web" => { "ssl" => true })
expect(args.data["auto"]).to eq("http://mydomain.org/tumbleweed.jsonnet")
end

it "sets #config_url if specified on cmdline" do
args = described_class.read_from(File.join(workdir, "/proc/cmdline"))
expect(args.config_url).to eql("http://example.org/agama.yaml")
end

it "converts 'true' and 'false' values into booleans" do
args = described_class.read_from(File.join(workdir, "/proc/cmdline"))
expect(args.data["web"]).to eql({ "ssl" => true })
end

it "converts keys with dots after 'agama.' to hash" do
args = described_class.read_from(File.join(workdir, "/proc/cmdline"))
# here fixture has agama.web.ssl=true and result is this hash
expect(args.data["web"]).to eq({ "ssl" => true })
end

it "properly parse values that contain '='" do
args = described_class.read_from(File.join(workdir, "/proc/cmdline"))
expect(args.data["install_url"]).to eq("cd:/?devices=/dev/sr1")
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a missing example for testing the "auto" value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, for auto it is plain option and it is in top level one at https://github.com/agama-project/agama/pull/1803/files#diff-68c3c88c1cfcfdc461f9d92425b028aa4ed3ca2a8c6239f2325b01fc4b0c8567R32
here it is intentionally using real cd schema that user complain on slack

end
end
2 changes: 1 addition & 1 deletion service/test/fixtures/root_dir/proc/cmdline
Original file line number Diff line number Diff line change
@@ -1 +1 @@
agama.config_url=http://example.org/agama.yaml agama.web.ssl=true
agama.config_url=http://example.org/agama.yaml agama.web.ssl=true agama.install_url=cd:/?devices=/dev/sr1 agama.auto=http://mydomain.org/tumbleweed.jsonnet