Skip to content

Commit

Permalink
Skip SLP discovery when going back (related to bsc#1071887)
Browse files Browse the repository at this point in the history
After registering the system the server cannot be changed anyway

- 4.1.19
  • Loading branch information
lslezak committed Mar 1, 2019
1 parent 0375962 commit 0ce1858
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
7 changes: 7 additions & 0 deletions package/yast2-registration.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Mar 1 09:50:20 UTC 2019 - lslezak@suse.cz

- Skip SLP discovery when going back after registering the system,
the server cannot be changed anyway (related to bsc#1071887)
- 4.1.19

-------------------------------------------------------------------
Mon Feb 25 12:32:35 UTC 2019 - 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: 4.1.18
Version: 4.1.19
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
15 changes: 13 additions & 2 deletions src/lib/registration/ui/base_system_registration_dialog.rb
Expand Up @@ -290,8 +290,9 @@ def register_scc_option
def register_local_option
# If not special URL is used, probe with SLP
if using_default_url?
services = UrlHelpers.slp_discovery_feedback
urls = services.map { |svc| UrlHelpers.service_url(svc.slp_url) }
# skip SLP discovery if the system is already registered
# during installation (the user is just going back)
urls = (Registration.is_registered? && !Yast::Mode.normal) ? [] : slp_urls
urls = [EXAMPLE_SMT_URL] if urls.empty?
else
urls = [reg_options[:custom_url]]
Expand Down Expand Up @@ -557,6 +558,16 @@ def using_default_url?
reg_options[:custom_url] == default_url
end

#
# Scan the network for SLP registration servers
#
# @return [Array<String>] The list of found URLs
#
def slp_urls
services = UrlHelpers.slp_discovery_feedback
services.map { |svc| UrlHelpers.service_url(svc.slp_url) }
end

# This method check whether the input is valid
#
# It relies on methods "validate_#!{action}".
Expand Down
10 changes: 9 additions & 1 deletion test/base_system_registration_dialog_test.rb
Expand Up @@ -220,11 +220,19 @@
context "when system is already registered" do
let(:registered?) { true }

before do
allow(subject).to receive(:event_loop).and_return(nil)
end

context "in installation mode" do
it "disables widgets" do
expect(Yast::UI).to receive(:ChangeWidget).with(Id(:action), :Enabled, false)
allow(Yast::UI).to receive(:ChangeWidget).and_call_original
allow(subject).to receive(:event_loop).and_return(nil)
subject.run
end

it "skips the SLP discovery" do
expect(Registration::UrlHelpers).to_not receive(:slp_discovery_feedback)
subject.run
end
end
Expand Down

0 comments on commit 0ce1858

Please sign in to comment.