Skip to content

Commit

Permalink
Disable the SLE_BCI repository after registration (PED-8817)
Browse files Browse the repository at this point in the history
- 4.6.3
  • Loading branch information
lslezak committed Sep 24, 2024
1 parent edb7881 commit c6a5d09
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
6 changes: 6 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Sep 24 11:43:29 UTC 2024 - Ladislav Slezák <lslezak@suse.com>

- Disable the SLE_BCI repository after registration (PED-8817)
- 4.6.3

-------------------------------------------------------------------
Wed May 29 13:34:10 UTC 2024 - Martin Vidner <mvidner@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-registration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 4.6.2
Version: 4.6.3
Release: 0
Summary: YaST2 - Registration Module
License: GPL-2.0-only
Expand Down
11 changes: 9 additions & 2 deletions src/lib/registration/clients/inst_scc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,15 @@ def register_base_system
base_reg_dialog = ::Registration::UI::BaseSystemRegistrationDialog.new
ret = base_reg_dialog.run

# remember the created registration object for later use
@registration = base_reg_dialog.registration if ret == :next
if ret == :next
# remember the created registration object for later use
@registration = base_reg_dialog.registration

# disable the BCI repository after registering, it is intended for
# not registered systems
Registration::SwMgmt.disable_bci
end

# tell #registration_check whether the user wants to go back (bnc#940915)
@back_from_register = (ret == :back)

Expand Down
17 changes: 17 additions & 0 deletions src/lib/registration/sw_mgmt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,23 @@ def self.update_product_renames(renames)
end
end

# name of the SLE BCI repository
SLE_BCI = "SLE_BCI".freeze

# disable the BCI repository
def self.disable_bci
enabled_repos = Yast::Pkg.SourceGetCurrent(true)

enabled_repos.each do |repo|
repo_data = Yast::Pkg.SourceGeneralData(repo)

if repo_data["alias"] == SLE_BCI
log.info "Disabling #{SLE_BCI} repository"
Yast::Pkg.SourceSetEnabled(repo, false)
end
end
end

# a helper method for iterating over repositories
# @param repo_aliases [Array<String>] list of repository aliases
# @param block block evaluated for each found repository
Expand Down
18 changes: 18 additions & 0 deletions test/sw_mgmt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -746,4 +746,22 @@
end
end

describe ".disable_bci" do
it "disables the SLE_BCI repository" do
expect(Yast::Pkg).to receive(:SourceGetCurrent).and_return([42])
expect(Yast::Pkg).to receive(:SourceGeneralData).with(42).and_return("alias" => "SLE_BCI")
expect(Yast::Pkg).to receive(:SourceSetEnabled).with(42, false)

subject.disable_bci
end

it "does not change anything if the SLE_BCI repository is not present" do
expect(Yast::Pkg).to receive(:SourceGetCurrent).and_return([42])
expect(Yast::Pkg).to receive(:SourceGeneralData).with(42).and_return("alias" => "repo")
expect(Yast::Pkg).not_to receive(:SourceSetEnabled)

subject.disable_bci
end
end

end

0 comments on commit c6a5d09

Please sign in to comment.