diff --git a/service/lib/agama/cmdline_args.rb b/service/lib/agama/cmdline_args.rb index ffd104a71c..2863f86856 100644 --- a/service/lib/agama/cmdline_args.rb +++ b/service/lib/agama/cmdline_args.rb @@ -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" diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index 73e1b06740..e24aa09ae9 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Dec 3 20:32:08 UTC 2024 - Josef Reidinger + +- Fix parsing agama.install_url that contain '=' + (gh#agama-project/agama#1803) + ------------------------------------------------------------------- Tue Dec 3 16:43:08 UTC 2024 - Imobach Gonzalez Sosa diff --git a/service/test/agama/cmdline_args_test.rb b/service/test/agama/cmdline_args_test.rb index d5048900e3..fee3a392f8 100644 --- a/service/test/agama/cmdline_args_test.rb +++ b/service/test/agama/cmdline_args_test.rb @@ -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 end end diff --git a/service/test/fixtures/root_dir/proc/cmdline b/service/test/fixtures/root_dir/proc/cmdline index 1943d63962..425b336d2b 100644 --- a/service/test/fixtures/root_dir/proc/cmdline +++ b/service/test/fixtures/root_dir/proc/cmdline @@ -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