Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SLE15-SP6] Disable the SLE_BCI repository after registration (PED-8817) #604

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>

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

-------------------------------------------------------------------
Wed May 29 13:34:10 UTC 2024 - Martin Vidner <[email protected]>

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
Loading