Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-registration for openSUSE:Factory checked in at 2022-05-30 12:42:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-registration (Old) and /work/SRC/openSUSE:Factory/.yast2-registration.new.2254 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-registration" Mon May 30 12:42:28 2022 rev:90 rq:979366 version:4.5.4 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-registration/yast2-registration.changes 2022-05-09 18:43:51.204189876 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-registration.new.2254/yast2-registration.changes 2022-05-30 12:42:57.100310779 +0200 @@ -1,0 +2,6 @@ +Thu May 26 14:55:59 UTC 2022 - Ladislav Slez??k <lsle...@suse.cz> + +- Support managing system in a chroot (bsc#1199840) +- 4.5.4 + +------------------------------------------------------------------- Old: ---- yast2-registration-4.5.3.tar.bz2 New: ---- yast2-registration-4.5.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.4z5h4C/_old 2022-05-30 12:42:57.652311514 +0200 +++ /var/tmp/diff_new_pack.4z5h4C/_new 2022-05-30 12:42:57.656311519 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 4.5.3 +Version: 4.5.4 Release: 0 Summary: YaST2 - Registration Module License: GPL-2.0-only ++++++ yast2-registration-4.5.3.tar.bz2 -> yast2-registration-4.5.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/package/yast2-registration.changes new/yast2-registration-4.5.4/package/yast2-registration.changes --- old/yast2-registration-4.5.3/package/yast2-registration.changes 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/package/yast2-registration.changes 2022-05-26 17:01:16.000000000 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu May 26 14:55:59 UTC 2022 - Ladislav Slez??k <lsle...@suse.cz> + +- Support managing system in a chroot (bsc#1199840) +- 4.5.4 + +------------------------------------------------------------------- Fri May 6 07:14:08 UTC 2022 - Ladislav Slez??k <lsle...@suse.cz> - Import the SSL certificate from the <reg_server_cert> AutoYaST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/package/yast2-registration.spec new/yast2-registration-4.5.4/package/yast2-registration.spec --- old/yast2-registration-4.5.3/package/yast2-registration.spec 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/package/yast2-registration.spec 2022-05-26 17:01:16.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 4.5.3 +Version: 4.5.4 Release: 0 Summary: YaST2 - Registration Module License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/src/lib/registration/clients/inst_migration_repos.rb new/yast2-registration-4.5.4/src/lib/registration/clients/inst_migration_repos.rb --- old/yast2-registration-4.5.3/src/lib/registration/clients/inst_migration_repos.rb 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/src/lib/registration/clients/inst_migration_repos.rb 2022-05-26 17:01:16.000000000 +0200 @@ -49,37 +49,7 @@ SwMgmt.copy_old_credentials(destdir) # import the SMT/RMT certificate to inst-sys - import_ssl_certificates - end - - # Import the old SSL certificate if present. Tries all known locations. - def import_ssl_certificates - prefix = Yast::Installation.destdir - - SslCertificate::PATHS.each do |file| - cert_file = File.join(prefix, file) - if File.exist?(cert_file) - log.info("Importing the SSL certificate from the old system: (#{prefix})#{file} ...") - cert = SslCertificate.load_file(cert_file) - log_certificate(cert) - target_path = File.join(SslCertificate::INSTSYS_CERT_DIR, File.basename(cert_file)) - cert.import_to_instsys(target_path) - else - log.debug("SSL certificate (#{prefix})#{file} not found in the system") - end - end - end - - # Log the certificate details - # @param cert [Registration::SslCertificate] the SSL certificate - def log_certificate(cert) - # log also the dates - log.info("#{SslCertificateDetails.new(cert).summary}\n" \ - "Issued on: #{cert.issued_on}\nExpires on: #{cert.expires_on}") - - # log a warning for expired certificate - expires = cert.x509_cert.not_after.localtime - log.warn("The certificate has EXPIRED! (#{expires})") if expires < Time.now + SslCertificate.import_from_system end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/src/lib/registration/clients/inst_scc.rb new/yast2-registration-4.5.4/src/lib/registration/clients/inst_scc.rb --- old/yast2-registration-4.5.3/src/lib/registration/clients/inst_scc.rb 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/src/lib/registration/clients/inst_scc.rb 2022-05-26 17:01:16.000000000 +0200 @@ -27,6 +27,7 @@ require "registration/addon" require "registration/exceptions" +require "registration/finish_dialog" require "registration/helpers" require "registration/connect_helpers" require "registration/sw_mgmt" @@ -208,6 +209,13 @@ ) end + # when managing a system in chroot copy the credentials and the SSL certificate + # from the chroot to the current system + if Yast::WFM.scr_chrooted? + ::Registration::SwMgmt.copy_old_credentials(Installation.destdir) + ::Registration::SslCertificate.import_from_system + end + if Mode.update ::Registration::SwMgmt.copy_old_credentials(Installation.destdir) @@ -268,6 +276,16 @@ end end + # finish the registration workflow + # @return [symbol] result symbol (:next) + def finish + # when managing a system in chroot copy the config file and the SSL certificate + # to the chroot target + ::Registration::FinishDialog.new.run("Write") if WFM.scr_chrooted? + + :next + end + def registration_ui ::Registration::RegistrationUI.new(@registration) end @@ -283,7 +301,8 @@ "addon_eula" => ->() { addon_eula }, "register_addons" => ->() { register_addons }, "update_autoyast_config" => ->() { update_autoyast_config }, - "pkg_manager" => ->() { pkg_manager } + "pkg_manager" => ->() { pkg_manager }, + "finish" => ->() { finish } } end @@ -333,6 +352,10 @@ }, "pkg_manager" => { abort: :abort, + next: "finish" + }, + "finish" => { + abort: :abort, next: :next } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/src/lib/registration/finish_dialog.rb new/yast2-registration-4.5.4/src/lib/registration/finish_dialog.rb --- old/yast2-registration-4.5.3/src/lib/registration/finish_dialog.rb 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/src/lib/registration/finish_dialog.rb 2022-05-26 17:01:16.000000000 +0200 @@ -59,7 +59,7 @@ remove_ncc_credentials nil else - raise "Uknown action #{func} passed as first parameter" + raise "Unknown action #{func} passed as first parameter" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/src/lib/registration/registration.rb new/yast2-registration-4.5.4/src/lib/registration/registration.rb --- old/yast2-registration-4.5.3/src/lib/registration/registration.rb 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/src/lib/registration/registration.rb 2022-05-26 17:01:16.000000000 +0200 @@ -24,6 +24,7 @@ require "y2packager/new_repository_setup" require "suse/connect" require "registration/connect_helpers" +require "registration/finish_dialog" require "registration/addon" require "registration/helpers" @@ -62,6 +63,13 @@ # write the global credentials SUSE::Connect::YaST.create_credentials_file(login, password) + + # when managing a system in chroot copy the credentials to the target system + if Yast::WFM.scr_chrooted? + target_path = File.join(Yast::Installation.destdir, self.class.credentials_path) + ::FileUtils.cp(self.class.credentials_path, target_path) + ::Registration::FinishDialog.new.run("Write") + end end def register_product(product, email = nil) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/src/lib/registration/ssl_certificate.rb new/yast2-registration-4.5.4/src/lib/registration/ssl_certificate.rb --- old/yast2-registration-4.5.3/src/lib/registration/ssl_certificate.rb 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/src/lib/registration/ssl_certificate.rb 2022-05-26 17:01:16.000000000 +0200 @@ -12,6 +12,7 @@ include Yast::Logger Yast.import "Stage" + Yast.import "Installation" # Path to the registration certificate in the instsys INSTSYS_CERT_DIR = "/etc/pki/trust/anchors".freeze @@ -219,6 +220,41 @@ self.class.update_instsys_ca end + # Import the old SSL certificate if present. Tries all known locations. + # Uses Installation.destdir as the root system. + def self.import_from_system + prefix = Yast::Installation.destdir + + SslCertificate::PATHS.each do |file| + cert_file = File.join(prefix, file) + if File.exist?(cert_file) + log.info("Importing the SSL certificate from other system: (#{prefix})#{file} ...") + cert = SslCertificate.load_file(cert_file) + cert.log_details + if Yast::Stage.initial + target_path = File.join(SslCertificate::INSTSYS_CERT_DIR, File.basename(cert_file)) + cert.import_to_instsys(target_path) + else + cert.import_to_system + end + else + log.debug("SSL certificate (#{prefix})#{file} not found in the system") + end + end + end + + # Log the certificate details + def log_details + require "registration/ssl_certificate_details" + # log also the dates + log.info("#{SslCertificateDetails.new(self).summary}\n" \ + "Issued on: #{issued_on}\nExpires on: #{expires_on}") + + # log a warning for expired certificate + expires = x509_cert.not_after.localtime + log.warn("The certificate has EXPIRED! (#{expires})") if expires < Time.now + end + private # @param x509_name [OpenSSL::X509::Name] name object diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/src/lib/registration/sw_mgmt.rb new/yast2-registration-4.5.4/src/lib/registration/sw_mgmt.rb --- old/yast2-registration-4.5.3/src/lib/registration/sw_mgmt.rb 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/src/lib/registration/sw_mgmt.rb 2022-05-26 17:01:16.000000000 +0200 @@ -365,13 +365,13 @@ credentials_file = UrlHelpers.credentials_from_url(product_service.url) if credentials_file - if Mode.update + if Mode.update || Yast::WFM.scr_chrooted? # at update libzypp is already switched to /mnt target, # update the path accordingly credentials_file = File.join(Installation.destdir, ::SUSE::Connect::YaST::DEFAULT_CREDENTIALS_DIR, credentials_file) - log.info "Using #{credentials_file} credentials path in update mode" + log.info "Using #{credentials_file} credentials path" end # SCC uses the same credentials for all services, just save them to # a different file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-4.5.3/test/inst_migration_repos_spec.rb new/yast2-registration-4.5.4/test/inst_migration_repos_spec.rb --- old/yast2-registration-4.5.3/test/inst_migration_repos_spec.rb 2022-05-06 09:47:44.000000000 +0200 +++ new/yast2-registration-4.5.4/test/inst_migration_repos_spec.rb 2022-05-26 17:01:16.000000000 +0200 @@ -12,6 +12,7 @@ before do allow(Yast::WFM).to receive(:call) allow(Yast::Installation).to receive(:destdir).and_return(destdir) + allow(Yast::Stage).to receive(:initial).and_return(true) allow(Registration::SwMgmt).to receive(:copy_old_credentials) allow(File).to receive(:exist?).and_return(false) end