diff --git a/rust/agama-lib/src/scripts/model.rs b/rust/agama-lib/src/scripts/model.rs index 10b28b12bf..a00462321e 100644 --- a/rust/agama-lib/src/scripts/model.rs +++ b/rust/agama-lib/src/scripts/model.rs @@ -75,8 +75,7 @@ impl BaseScript { #[derive(Clone, Debug, Serialize, Deserialize, utoipa::ToSchema)] #[serde(untagged)] pub enum ScriptSource { - /// Script's content. Deprecated name was body which is still accepted. - #[serde(alias = "body")] + /// Script's content. Text { content: String }, /// URL to get the script from. Remote { url: String }, diff --git a/service/lib/agama/autoyast/scripts_reader.rb b/service/lib/agama/autoyast/scripts_reader.rb index adc0cc2fc7..817bab26f8 100755 --- a/service/lib/agama/autoyast/scripts_reader.rb +++ b/service/lib/agama/autoyast/scripts_reader.rb @@ -120,7 +120,7 @@ def read_script(section) if section["location"] && !section["location"].empty? script["url"] = section["location"] elsif section["source"] - script["body"] = section["source"] + script["content"] = section["source"] end script diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index a1914592f8..166f9a8033 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Mar 28 11:13:48 UTC 2025 - Imobach Gonzalez Sosa + +- Properly map AutoYaST scripts "source" to "content" + (gh#agama-project/agama#2224). + ------------------------------------------------------------------- Thu Mar 27 12:35:32 UTC 2025 - Ladislav Slezák diff --git a/service/share/autoyast-compat.json b/service/share/autoyast-compat.json index 3a3b0e9f6d..31e4dee24d 100644 --- a/service/share/autoyast-compat.json +++ b/service/share/autoyast-compat.json @@ -262,7 +262,7 @@ "agama": "scripts.pre[].name" }, { "key": "location", "support": "yes", "agama": "scripts.pre[].url" }, - { "key": "source", "support": "yes", "agama": "scripts.pre[].body" }, + { "key": "source", "support": "yes", "agama": "scripts.pre[].content" }, { "key": "interpreter", "support": "no", @@ -292,7 +292,7 @@ { "key": "source", "support": "yes", - "agama": "scripts.postPartitioning[].body" + "agama": "scripts.postPartitioning[].content" }, { "key": "interpreter", @@ -324,7 +324,7 @@ { "key": "source", "support": "yes", - "agama": "scripts.chroot[].body" + "agama": "scripts.chroot[].content" }, { "key": "interpreter", @@ -353,7 +353,7 @@ "support": "yes", "agama": "scripts.init[].url" }, - { "key": "source", "support": "yes", "agama": "scripts.init[].body" }, + { "key": "source", "support": "yes", "agama": "scripts.init[].content" }, { "key": "interpreter", "support": "no", @@ -381,7 +381,7 @@ "support": "yes", "agama": "scripts.init[].url" }, - { "key": "source", "support": "yes", "agama": "scripts.init[].body" }, + { "key": "source", "support": "yes", "agama": "scripts.init[].content" }, { "key": "rerun", "support": "no" } ] } diff --git a/service/test/agama/autoyast/scripts_reader_test.rb b/service/test/agama/autoyast/scripts_reader_test.rb index c8d6328b19..e96c94c929 100644 --- a/service/test/agama/autoyast/scripts_reader_test.rb +++ b/service/test/agama/autoyast/scripts_reader_test.rb @@ -72,9 +72,9 @@ } end - it "sets the \"body\" to the \"sources\"" do + it "uses the \"sources\" as \"content\"" do scripts = subject.read["scripts"][section] - expect(scripts.first).to include("body" => "#!/bin/bash\necho 'Hello World!'") + expect(scripts.first).to include("content" => "#!/bin/bash\necho 'Hello World!'") end context "and the script filename is not specified" do @@ -133,7 +133,9 @@ expect(subject.read["scripts"]).to include( "post" => [ { - "name" => "test.sh", "chroot" => false, "body" => "#!/bin/bash\necho 'Hello World!'" + "name" => "test.sh", + "chroot" => false, + "content" => "#!/bin/bash\necho 'Hello World!'" } ] )