Hello community,

here is the log from the commit of package yast2-registration for 
openSUSE:Factory checked in at 2018-03-26 12:13:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-registration (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-registration.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-registration"

Mon Mar 26 12:13:53 2018 rev:15 rq:589933 version:4.0.28

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-registration/yast2-registration.changes    
2018-03-18 21:42:31.118741513 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-registration.new/yast2-registration.changes   
    2018-03-26 12:13:57.815387558 +0200
@@ -1,0 +2,14 @@
+Wed Mar 21 16:40:25 UTC 2018 - [email protected]
+
+- Import the SMT SSL certificate at offline upgrade into
+  the inst-sys so the SMT server can be accessed (bsc#1080518)
+- 4.0.28
+
+-------------------------------------------------------------------
+Mon Mar 19 10:39:30 UTC 2018 - [email protected]
+
+- Do not hide beta addons that are preselected (bsc#1066216,
+  bsc#1085286)
+- 4.0.27
+
+-------------------------------------------------------------------

Old:
----
  yast2-registration-4.0.26.tar.bz2

New:
----
  yast2-registration-4.0.28.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-registration.spec ++++++
--- /var/tmp/diff_new_pack.Dv5aJk/_old  2018-03-26 12:14:00.099305686 +0200
+++ /var/tmp/diff_new_pack.Dv5aJk/_new  2018-03-26 12:14:00.103305543 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-registration
-Version:        4.0.26
+Version:        4.0.28
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-registration-4.0.26.tar.bz2 -> yast2-registration-4.0.28.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/package/yast2-registration.changes 
new/yast2-registration-4.0.28/package/yast2-registration.changes
--- old/yast2-registration-4.0.26/package/yast2-registration.changes    
2018-03-16 19:38:35.000000000 +0100
+++ new/yast2-registration-4.0.28/package/yast2-registration.changes    
2018-03-22 08:40:36.000000000 +0100
@@ -1,4 +1,18 @@
 -------------------------------------------------------------------
+Wed Mar 21 16:40:25 UTC 2018 - [email protected]
+
+- Import the SMT SSL certificate at offline upgrade into
+  the inst-sys so the SMT server can be accessed (bsc#1080518)
+- 4.0.28
+
+-------------------------------------------------------------------
+Mon Mar 19 10:39:30 UTC 2018 - [email protected]
+
+- Do not hide beta addons that are preselected (bsc#1066216,
+  bsc#1085286)
+- 4.0.27
+
+-------------------------------------------------------------------
 Fri Mar 16 17:17:42 UTC 2018 - [email protected]
 
 - Implemented the registration rollback functionality when going
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/package/yast2-registration.spec 
new/yast2-registration-4.0.28/package/yast2-registration.spec
--- old/yast2-registration-4.0.26/package/yast2-registration.spec       
2018-03-16 19:38:35.000000000 +0100
+++ new/yast2-registration-4.0.28/package/yast2-registration.spec       
2018-03-22 08:40:36.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-registration
-Version:        4.0.26
+Version:        4.0.28
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/src/lib/registration/clients/inst_migration_repos.rb
 
new/yast2-registration-4.0.28/src/lib/registration/clients/inst_migration_repos.rb
--- 
old/yast2-registration-4.0.26/src/lib/registration/clients/inst_migration_repos.rb
  2018-03-16 19:38:35.000000000 +0100
+++ 
new/yast2-registration-4.0.28/src/lib/registration/clients/inst_migration_repos.rb
  2018-03-22 08:40:36.000000000 +0100
@@ -28,8 +28,8 @@
 
         Yast.import "Installation"
 
-        # initialize the target path
-        set_target_path
+        # initialize the inst-sys
+        instsys_init
 
         # call the normal client
         Yast::WFM.call("migration_repos", [{ "enable_back" => true }])
@@ -37,13 +37,36 @@
 
     private
 
-      # Pass the target directory to SUSEConnect
-      def set_target_path
+      # activate the configuration from the target system in the current 
inst-sys
+      def instsys_init
         destdir = Yast::Installation.destdir || "/"
         return if destdir == "/"
 
         # copy the old NCC/SCC credentials to inst-sys
         SwMgmt.copy_old_credentials(destdir)
+
+        # import the SMT certificate to inst-sys
+        import_ssl_certificate
+      end
+
+      # Import the old SSL certificate if present. Tries both SLE12 nad SLE11
+      # file locations.
+      def import_ssl_certificate
+        # SLE12 certificate path
+        cert_file = File.join(Yast::Installation.destdir, 
SUSE::Connect::YaST::SERVER_CERT_FILE)
+
+        if !File.exist?(cert_file)
+          # try the the SLE11 certificate path as well
+          cert_file = File.join(Yast::Installation.destdir,
+            SslCertificate::SLE11_SERVER_CERT_FILE)
+
+          return unless File.exist?(cert_file)
+        end
+
+        log.info("Importing the SSL certificate from the old system 
(#{cert_file})...")
+        cert = SslCertificate.load_file(cert_file)
+        # in Stage.initial this imports to the inst-sys
+        cert.import
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/src/lib/registration/ssl_certificate.rb 
new/yast2-registration-4.0.28/src/lib/registration/ssl_certificate.rb
--- old/yast2-registration-4.0.26/src/lib/registration/ssl_certificate.rb       
2018-03-16 19:38:35.000000000 +0100
+++ new/yast2-registration-4.0.28/src/lib/registration/ssl_certificate.rb       
2018-03-22 08:40:36.000000000 +0100
@@ -13,6 +13,9 @@
 
     # Path to the registration certificate in the instsys
     INSTSYS_SERVER_CERT_FILE = 
"/etc/pki/trust/anchors/registration_server.pem".freeze
+    # the SLE11 certificate path, see
+    # 
https://github.com/yast/yast-registration/blob/Code-11-SP3/src/modules/Register.ycp#L296-L297
+    SLE11_SERVER_CERT_FILE = "/etc/ssl/certs/registration-server.pem".freeze
     # Path to system CA certificates
     CA_CERTS_DIR = "/var/lib/ca-certificates".freeze
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/src/lib/registration/ui/addon_selection_base_dialog.rb
 
new/yast2-registration-4.0.28/src/lib/registration/ui/addon_selection_base_dialog.rb
--- 
old/yast2-registration-4.0.26/src/lib/registration/ui/addon_selection_base_dialog.rb
        2018-03-16 19:38:35.000000000 +0100
+++ 
new/yast2-registration-4.0.28/src/lib/registration/ui/addon_selection_base_dialog.rb
        2018-03-22 08:40:36.000000000 +0100
@@ -69,7 +69,8 @@
         self.class.filter_beta = enable
         if enable
           @addons = @all_addons.select do |a|
-            a.registered? || a.selected? || !a.beta_release?
+            a.registered? || a.selected? || a.auto_selected? ||
+              !a.beta_release?
           end
         else
           @addons = @all_addons
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/src/lib/registration/ui/offline_migration_workflow.rb
 
new/yast2-registration-4.0.28/src/lib/registration/ui/offline_migration_workflow.rb
--- 
old/yast2-registration-4.0.26/src/lib/registration/ui/offline_migration_workflow.rb
 2018-03-16 19:38:35.000000000 +0100
+++ 
new/yast2-registration-4.0.28/src/lib/registration/ui/offline_migration_workflow.rb
 2018-03-22 08:40:36.000000000 +0100
@@ -61,9 +61,12 @@
         # refresh the add-on records
         update_addon_records
 
-        # go back in the upgrade workflow after rollback or abort,
-        # maybe the user just selected a wrong partition to upgrade
-        ui = :back if ui == :abort || ui == :rollback
+        if [:back, :abort, :rollback].include?(ui)
+          inst_sys_cleanup
+          # go back in the upgrade workflow after rollback or abort,
+          # maybe the user just selected a wrong partition to upgrade
+          ui = :back
+        end
 
         log.info "Offline migration result: #{ui}"
         ui
@@ -78,17 +81,55 @@
           log.info("Restoring the previous registration")
           rollback
         end
+
+        inst_sys_cleanup
       end
 
       def rollback
         Yast::WFM.CallFunction("registration_sync")
+      end
 
-        # remove the copied credentials file from the target system to not be
-        # used again by mistake (skip if accidentally called in a running 
system)
-        if Yast::Stage.initial && 
File.exist?(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
+      # cleanup the inst-sys, remove the files copied from the target system
+      def inst_sys_cleanup
+        # skip inst-sys cleanup if accidentally called in a running system
+        return unless Yast::Stage.initial
+
+        # remove the copied credentials file from the inst-sys
+        if File.exist?(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
           log.info("Removing 
#{SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE}...")
           File.delete(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
         end
+
+        certificate_cleanup if 
File.exist?(SslCertificate::INSTSYS_SERVER_CERT_FILE)
+      end
+
+      # remove the SSL certificate from the inst-sys
+      def certificate_cleanup
+        log.info("Removing the imported SSL certificate from the inst-sys...")
+
+        # Update database
+        Yast::Execute.locally("trust", "extract", "--format=openssl-directory",
+          "--filter=ca-anchors", "--overwrite", 
SslCertificate::TMP_CA_CERTS_DIR)
+
+        # Copy certificates/links
+        files = Dir[File.join(SslCertificate::TMP_CA_CERTS_DIR, "*")]
+        targets = ["pem", "openssl"].map { |d| 
File.join(SslCertificate::CA_CERTS_DIR, d) }
+
+        targets.each do |subdir|
+          files.each do |file|
+            path = File.join(subdir, File.basename(file))
+            if File.exist?(path)
+              log.info("Removing #{path}")
+              File.delete(path)
+            end
+          end
+        end
+
+        log.info("Removing #{SslCertificate::INSTSYS_SERVER_CERT_FILE}")
+        File.delete(SslCertificate::INSTSYS_SERVER_CERT_FILE)
+
+        # Cleanup
+        FileUtils.rm_rf(SslCertificate::TMP_CA_CERTS_DIR)
       end
 
       def migration_repos
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/test/addon_selection_dialog_test.rb 
new/yast2-registration-4.0.28/test/addon_selection_dialog_test.rb
--- old/yast2-registration-4.0.26/test/addon_selection_dialog_test.rb   
2018-03-16 19:38:35.000000000 +0100
+++ new/yast2-registration-4.0.28/test/addon_selection_dialog_test.rb   
2018-03-22 08:40:36.000000000 +0100
@@ -216,6 +216,17 @@
         allow(subject).to receive(:RichText).and_call_original
         dialog.run
       end
+
+      it "displays auto-selected beta add-ons" do
+        allow(addon).to receive(:beta_release?).and_return(true)
+        allow(addon).to receive(:registered?).and_return(false)
+        allow(addon).to receive(:recommended).and_return(false)
+        allow(addon).to receive(:auto_selected?).and_return(true)
+        allow(Registration::Addon).to receive(:find_all).and_return([addon])
+        expect(subject).to receive(:RichText).with(Yast::Term.new(:id, 
:items), /#{addon.name}/)
+        allow(subject).to receive(:RichText).and_call_original
+        dialog.run
+      end
     end
 
     context "when there is no beta versions to filter" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/test/inst_migration_repos_spec.rb 
new/yast2-registration-4.0.28/test/inst_migration_repos_spec.rb
--- old/yast2-registration-4.0.26/test/inst_migration_repos_spec.rb     
2018-03-16 19:38:35.000000000 +0100
+++ new/yast2-registration-4.0.28/test/inst_migration_repos_spec.rb     
2018-03-22 08:40:36.000000000 +0100
@@ -5,13 +5,45 @@
 require "registration/clients/inst_migration_repos"
 
 describe Registration::Clients::InstMigrationRepos do
+  let(:destdir) { "/mnt" }
+  let(:sle12_cert) { File.join(destdir, SUSE::Connect::YaST::SERVER_CERT_FILE) 
}
+  let(:sle11_cert) { File.join(destdir, 
Registration::SslCertificate::SLE11_SERVER_CERT_FILE) }
+
   before do
-    allow(Yast::Installation).to receive(:destdir).and_return("/")
     allow(Yast::WFM).to receive(:call)
+    allow(Yast::Installation).to receive(:destdir).and_return(destdir)
+    allow(Registration::SwMgmt).to receive(:copy_old_credentials)
+    allow(File).to receive(:exist?).and_return(false)
   end
 
   it "runs the standard \"migration_repos\" client" do
+    allow(Yast::Installation).to receive(:destdir).and_return("/")
     expect(Yast::WFM).to receive(:call).with("migration_repos", anything)
     subject.main
   end
+
+  it "imports the old credentials" do
+    expect(Registration::SwMgmt).to receive(:copy_old_credentials)
+    subject.main
+  end
+
+  it "imports the old SLE12 SSL certificate" do
+    expect(File).to receive(:exist?).with(sle12_cert).and_return(true)
+    expect(File).to receive(:read).with(sle12_cert).and_return(
+      File.read(fixtures_file("test.pem"))
+    )
+    expect_any_instance_of(Registration::SslCertificate).to receive(:import)
+
+    subject.main
+  end
+
+  it "imports the old SLE11 SSL certificate" do
+    expect(File).to receive(:exist?).with(sle11_cert).and_return(true)
+    expect(File).to receive(:read).with(sle11_cert).and_return(
+      File.read(fixtures_file("test.pem"))
+    )
+    expect_any_instance_of(Registration::SslCertificate).to receive(:import)
+
+    subject.main
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.26/test/offline_migration_workflow_test.rb 
new/yast2-registration-4.0.28/test/offline_migration_workflow_test.rb
--- old/yast2-registration-4.0.26/test/offline_migration_workflow_test.rb       
2018-03-16 19:38:35.000000000 +0100
+++ new/yast2-registration-4.0.28/test/offline_migration_workflow_test.rb       
2018-03-22 08:40:36.000000000 +0100
@@ -10,7 +10,32 @@
       allow(Yast::Packages).to receive(:Initialize)
       allow(Yast::GetInstArgs).to receive(:going_back)
       allow(File).to receive(:delete)
+      allow(File).to receive(:exist?)
       allow(Yast::WFM).to receive(:CallFunction)
+      allow(Yast::Stage).to receive(:initial).and_return(true)
+    end
+
+    shared_examples "certificate cleanup" do
+      it "removes the SSL ceritificate from inst-sys" do
+        expect(File).to receive(:exist?)
+          .with(Registration::SslCertificate::INSTSYS_SERVER_CERT_FILE)
+          .and_return(true)
+        expect(Yast::Execute).to receive(:locally).with("trust", "extract",
+          "--format=openssl-directory", "--filter=ca-anchors", "--overwrite",
+          Registration::SslCertificate::TMP_CA_CERTS_DIR)
+        expect(Dir).to receive(:[])
+          .with(File.join(Registration::SslCertificate::TMP_CA_CERTS_DIR, "*"))
+          
.and_return([File.join(Registration::SslCertificate::TMP_CA_CERTS_DIR, 
"smt.pem")])
+
+        var_lib_cert = File.join(Registration::SslCertificate::CA_CERTS_DIR, 
"/openssl/smt.pem")
+        expect(File).to receive(:exist?).with(var_lib_cert).and_return(true)
+        expect(File).to receive(:delete).with(var_lib_cert)
+
+        expect(File).to receive(:delete)
+          .with(Registration::SslCertificate::INSTSYS_SERVER_CERT_FILE)
+        expect(FileUtils).to 
receive(:rm_rf).with(Registration::SslCertificate::TMP_CA_CERTS_DIR)
+        subject.main
+      end
     end
 
     context "when going back" do
@@ -34,15 +59,14 @@
           allow(Yast::WFM).to receive(:CallFunction).with("registration_sync")
         end
 
+        include_examples "certificate cleanup"
+
         it "runs rollback" do
           expect(Yast::WFM).to receive(:CallFunction).with("registration_sync")
           subject.main
         end
 
         it "removes the copied credentials" do
-          expect(Yast::Stage).to receive(:initial).and_return(true)
-          # allow the other cases
-          allow(File).to receive(:exist?)
           expect(File).to 
receive(:exist?).with(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
             .and_return(true)
           expect(File).to 
receive(:delete).with(SUSE::Connect::YaST::GLOBAL_CREDENTIALS_FILE)
@@ -117,6 +141,8 @@
         allow(Yast::WFM).to receive(:CallFunction).with("registration_sync")
       end
 
+      include_examples "certificate cleanup"
+
       it "runs the 'registration_sync' client" do
         expect(Yast::WFM).to receive(:CallFunction).with("registration_sync")
         subject.main


Reply via email to