diff --git a/package/yast2-registration.changes b/package/yast2-registration.changes index 784dd440b..1575912e7 100644 --- a/package/yast2-registration.changes +++ b/package/yast2-registration.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Apr 8 15:31:18 UTC 2015 - lslezak@suse.cz + +- collect product rename also for the base product (the internal + SLES-for-SAP product identifier has been changed) (bsc#925700) +- 3.1.129.1 + ------------------------------------------------------------------- Thu Nov 6 08:32:36 UTC 2014 - lslezak@suse.cz diff --git a/package/yast2-registration.spec b/package/yast2-registration.spec index 15e895b34..2f594507c 100644 --- a/package/yast2-registration.spec +++ b/package/yast2-registration.spec @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.129 +Version: 3.1.129.1 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/src/lib/registration/registration.rb b/src/lib/registration/registration.rb index bd0b52b3a..342f56e09 100644 --- a/src/lib/registration/registration.rb +++ b/src/lib/registration/registration.rb @@ -68,6 +68,9 @@ def register_product(product, email = nil) log.info "Register product result: #{service}" set_registered(product_ident) + renames = collect_renames([service.product]) + SwMgmt.update_product_renames(renames) + service end end @@ -79,6 +82,9 @@ def upgrade_product(product) log.info "Upgrade product result: #{service}" set_registered(product_ident) + renames = collect_renames([service.product]) + SwMgmt.update_product_renames(renames) + service end end @@ -225,12 +231,15 @@ def connect_params(params = {}) default_params.merge(params) end - def collect_renames(addons) + # collect product renames + # @param products [Array] remote products received from SCC + # @return [Hash] hash with product renames: { old_name => new_name } + def collect_renames(products) renames = {} - addons.each do |addon| - if addon.former_identifier && addon.identifier != addon.former_identifier - renames[addon.former_identifier] = addon.identifier + products.each do |product| + if product.former_identifier && product.identifier != product.former_identifier + renames[product.former_identifier] = product.identifier end end diff --git a/test/registration_spec.rb b/test/registration_spec.rb index b997901a7..5c93fc602 100644 --- a/test/registration_spec.rb +++ b/test/registration_spec.rb @@ -36,10 +36,12 @@ it "adds the selected product and returns added zypp services" do product = { - "arch" => "x86_64", - "name" => "sle-sdk", - "version" => "12", - "release_type" => nil + "arch" => "x86_64", + "name" => "sle-sdk", + "version" => "12", + "release_type" => nil, + "identifier" => "SLES_SAP", + "former_identifier" => "SUSE_SLES_SAP" } service_data = { @@ -58,6 +60,10 @@ expect(available_addons.find { |addon| addon.identifier == "sle-sdk" }).to \ receive(:registered) + # the received product renames are passed to the software management + expect(Registration::SwMgmt).to receive(:update_product_renames) + .with("SUSE_SLES_SAP" => "SLES_SAP") + allow(File).to receive(:exist?).with( SUSE::Connect::Credentials::GLOBAL_CREDENTIALS_FILE).and_return(true) allow(File).to receive(:read).with(