Skip to content

Commit

Permalink
fixed setting the repository status (bnc#875839)
Browse files Browse the repository at this point in the history
to properly enable e.g. the *-Pool repositories

- 3.1.48
  • Loading branch information
lslezak committed May 7, 2014
1 parent 7319d63 commit a62f2e3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
7 changes: 7 additions & 0 deletions package/yast2-registration.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed May 7 11:38:30 UTC 2014 - lslezak@suse.cz

- fixed setting the repository status (to properly enable e.g. the
*-Pool repositories) (bnc#875839)
- 3.1.48

-------------------------------------------------------------------
Tue May 6 12:38:51 UTC 2014 - lslezak@suse.cz

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-registration.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 3.1.47
Version: 3.1.48
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
20 changes: 16 additions & 4 deletions src/lib/registration/sw_mgmt.rb
Expand Up @@ -111,7 +111,7 @@ def self.base_product_label(base_product)
def self.base_product_to_register
# just for debugging:
# return {"name" => "SLES", "arch" => "x86_64", "version" => "12",
# "release_type" => "DVD"
# "release_type" => "DVD"
# }

base_product = find_base_product
Expand Down Expand Up @@ -188,8 +188,14 @@ def self.add_services(product_services, credentials)
end

# activate the requested repository setup
repos_enable(product_services.map(&:enabled).flatten)
repos_disable_autorefresh(product_services.map(&:norefresh).flatten)
product_services.each do |product_service|
# there is only one service
service_name = product_service.sources.first.name
log.info "Updating repositories for service: #{service_name}"

repos_enable(service_aliases(service_name, product_service.enabled))
repos_disable_autorefresh(service_aliases(service_name, product_service.norefresh))
end
ensure
Pkg.SourceSaveAll
end
Expand Down Expand Up @@ -274,8 +280,14 @@ def self.each_repo(repo_aliases, &block)
end
end
end

# get libzypp repository aliases for a service
# (libzypp internally uses the service name as the prefix)
def self.service_aliases(service, aliases)
aliases.map{ |a| "#{service}:#{a}"}
end

private_class_method :each_repo
private_class_method :each_repo, :service_aliases
end
end

4 changes: 2 additions & 2 deletions test/sw_mgmt_spec.rb
Expand Up @@ -94,8 +94,8 @@
let(:service_url) { "https://example.com/foo/bar?credentials=TEST_credentials" }
let(:credentials) { SUSE::Connect::Credentials.new("user", "password", "file") }
let(:product_services) do
SUSE::Connect::Service.new({service_name => service_url}, ["SLES:SLES12-Pool"],
["SLES:SLES12-Pool"])
SUSE::Connect::Service.new({service_name => service_url}, ["SLES12-Pool"],
["SLES12-Pool"])
end

before do
Expand Down

0 comments on commit a62f2e3

Please sign in to comment.