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
12 changes: 11 additions & 1 deletion service/lib/agama/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def deregister
run_on_change_callbacks
end

# Copies credentials files to the target system.
# Copies configuration and credentials files to the target system.
#
# The configuration file is copied only if a registration URL was given.
def finish
return unless reg_code

Expand All @@ -185,6 +187,14 @@ def finish
]
end

if registration_url
SUSE::Connect::YaST.write_config("url" => registration_url)
files << [
SUSE::Connect::Config::DEFAULT_CONFIG_FILE,
File.join(Yast::Installation.destdir, SUSE::Connect::Config::DEFAULT_CONFIG_FILE)
]
end

files.each do |src_dest|
FileUtils.cp(*src_dest)
end
Expand Down
5 changes: 5 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Apr 9 06:42:38 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Write the registration URL to the installed system (bsc#1239316).

-------------------------------------------------------------------
Tue Apr 1 12:44:57 UTC 2025 - Ladislav Slezák <lslezak@suse.com>

Expand Down
13 changes: 13 additions & 0 deletions service/test/agama/registration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,19 @@

subject.finish
end

context "and a registration URL was given" do
before do
allow(subject).to receive(:registration_url).and_return("http://reg-server.lan")
end

it "generates and copies the SUSEConnect configuration" do
expect(::FileUtils).to receive(:cp).with("/etc/SUSEConnect", "/mnt/etc/SUSEConnect")
expect(SUSE::Connect::YaST).to receive(:write_config).with("url" => "http://reg-server.lan")

subject.finish
end
end
end
end
end
Loading