Skip to content

Commit

Permalink
copy proper location of product credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 9, 2025
1 parent 83a8c0d commit 2c87855
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions service/lib/agama/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,18 @@ def deregister
def finish
return unless reg_code

files = [GLOBAL_CREDENTIALS_PATH]
files << credentials_path(@credentials_file) if @credentials_file
files = [[
GLOBAL_CREDENTIALS_PATH, File.join(Yast::Installation.destdir, GLOBAL_CREDENTIALS_PATH)
]]
if @credentials_file
files << [
File.join(TARGET_DIR, credentials_path(@credentials_file)),
File.join(Yast::Installation.destdir, credentials_path(@credentials_file)),
]
end

files.each do |file|
dest = File.join(Yast::Installation.destdir, file)
FileUtils.cp(file, dest)
files.each do |files|
FileUtils.cp(*files)
end
end

Expand Down
2 changes: 1 addition & 1 deletion service/test/agama/registration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
end

it "copies product credentials file" do
expect(::FileUtils).to receive(:cp).with("/etc/zypp/credentials.d/test",
expect(::FileUtils).to receive(:cp).with("/run/agama/zypp/etc/zypp/credentials.d/test",
"/mnt/etc/zypp/credentials.d/test")

subject.finish
Expand Down

0 comments on commit 2c87855

Please sign in to comment.