diff --git a/service/lib/agama/registration.rb b/service/lib/agama/registration.rb index 658a1c9c8..e47463131 100644 --- a/service/lib/agama/registration.rb +++ b/service/lib/agama/registration.rb @@ -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 diff --git a/service/test/agama/registration_test.rb b/service/test/agama/registration_test.rb index 2670ae385..1efb802ab 100644 --- a/service/test/agama/registration_test.rb +++ b/service/test/agama/registration_test.rb @@ -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