Skip to content
Permalink
Browse files

Merge pull request #182 from yast/base_product_rename

Collect product rename also for the base product (bsc#925700)
  • Loading branch information...
lslezak committed Apr 9, 2015
2 parents bdb8057 + f788a37 commit 0c14381285ffd70a41f96d49af880218d2223b30
@@ -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

@@ -17,7 +17,7 @@


Name: yast2-registration
Version: 3.1.129
Version: 3.1.129.1
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -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<SUSE::Connect::Remote::Product>] 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

@@ -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(

0 comments on commit 0c14381

Please sign in to comment.
You can’t perform that action at this time.