Skip to content

Commit

Permalink
always enable update repositories for modules (bsc#953536)
Browse files Browse the repository at this point in the history
(during online migration)

Conflicts:
	package/yast2-registration.changes
	package/yast2-registration.spec
  • Loading branch information
lslezak committed Nov 9, 2015
1 parent 28bd6a9 commit 520cce1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
6 changes: 6 additions & 0 deletions package/yast2-registration.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 6 20:26:06 UTC 2015 - lslezak@suse.cz

- always enable update repositories for modules during online
migration (bsc#953536)

-------------------------------------------------------------------
Mon Oct 19 07:21:58 UTC 2015 - lslezak@suse.cz

Expand Down
15 changes: 13 additions & 2 deletions src/lib/registration/migration_repositories.rb
Expand Up @@ -53,6 +53,8 @@ def service_with_update_repo?
def activate_services
# disable the update repositories if not required
if !install_updates
# note: the module update repositories are kept enabled
# see https://bugzilla.suse.com/show_bug.cgi?id=953536
SwMgmt.set_repos_state(services_repositories(only_updates: true), false)
end

Expand Down Expand Up @@ -111,14 +113,23 @@ def select_patches
end

# evaluate migration repositories and services
# @param [Boolean] only_updates return only the update repositories
# @param [Boolean] only_updates return only the update repositories,
# for modules the update repositories are never returned
# @return [Array<Fixnum>] list of used migration repositories
def services_repositories(only_updates: false)
service_repos = services.map do |service|
# ignore update repositories for modules
services_to_search = only_updates ? non_module_services : services
service_repos = services_to_search.map do |service|
SwMgmt.service_repos(service, only_updates: only_updates)
end

service_repos.flatten
end

# return services of different type than module
# @return [Array] list of services
def non_module_services
services.select { |s| s.product.product_type != "module" }
end
end
end
18 changes: 16 additions & 2 deletions test/migration_repositories_spec.rb
Expand Up @@ -21,7 +21,7 @@
expect(Yast::Pkg).to receive(:SourceLoad)
end

it "activates the specified sevices for upgrade" do
it "activates the specified services for upgrade" do
subject.services << "test_service"
allow(Yast::Pkg).to receive(:ResolvablePreselectPatches)

Expand All @@ -37,7 +37,8 @@
end

it "disables update repositories if updates should not be installed" do
service = "test_service"
product = double("test_product", product_type: "base")
service = double("test_service", product: product)
repo = 42
subject.install_updates = false
subject.services << service
Expand All @@ -50,6 +51,19 @@

subject.activate_services
end

it "keeps module update repositories enabled eventhough updates should not be installed" do
product = double("test_product", product_type: "module")
service = double("test_service", product: product)

subject.install_updates = false
subject.services << service

# empty list of disabled repositories
expect(Registration::SwMgmt).to receive(:set_repos_state).with([], false)

subject.activate_services
end
end

describe "#activate_repositories" do
Expand Down

0 comments on commit 520cce1

Please sign in to comment.