Skip to content

Commit

Permalink
Merge pull request #608 from yast/disable_bci_repo_master
Browse files Browse the repository at this point in the history
[master] Disable the SLE_BCI repository after registration (PED-8817)
  • Loading branch information
lslezak authored Sep 24, 2024
2 parents 9a96a1f + b5e4be2 commit 697ed68
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
11 changes: 11 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Sep 24 11:43:29 UTC 2024 - Ladislav Slezák <[email protected]>

- Disable the SLE_BCI repository after registration (jsc#PED-8817)
- 5.0.3

-------------------------------------------------------------------
Fri Sep 06 07:14:32 UTC 2024 - Ladislav Slezák <[email protected]>

- Branch package for SP7 (bsc#1230201)

-------------------------------------------------------------------
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: 5.0.2
Version: 5.0.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 @@ -598,6 +598,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 697ed68

Please sign in to comment.