Skip to content

Commit

Permalink
Merge b71f57c into 3beb5c9
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Oct 12, 2018
2 parents 3beb5c9 + b71f57c commit 4bb39c1
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 9 deletions.
10 changes: 10 additions & 0 deletions package/yast2-registration.changes
@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Fri Oct 12 10:41:27 CEST 2018 - schubi@suse.de

- Added tags full_system_media_name and full_system_download_url
in control.xml which describe the location for the
"all-packages" medium. This information will be shown if the
registration has been scipped by the user. No hint will be shown
if these tags have not been defined. (fate#325834)
- 4.0.45

-------------------------------------------------------------------
Fri Aug 31 10:12:16 UTC 2018 - 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.0.44
Version: 4.0.45
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
30 changes: 23 additions & 7 deletions src/lib/registration/ui/base_system_registration_dialog.rb
Expand Up @@ -31,6 +31,7 @@ class BaseSystemRegistrationDialog
Yast.import "Wizard"
Yast.import "Popup"
Yast.import "Report"
Yast.import "ProductFeatures"

WIDGETS = {
register_scc: [:email, :reg_code],
Expand Down Expand Up @@ -358,17 +359,32 @@ def help_text
#
# @return [Boolean] true when skipping has been confirmed
def show_skipping_warning
media_name = ProductFeatures.GetStringFeature(
"globals",
"full_system_media_name"
)
download_url = ProductFeatures.GetStringFeature(
"globals",
"full_system_download_url"
)

warning = _("Without registration, update channels will not be\n" \
"configured. This disables updates and security fixes.")

# Popup question: confirm skipping the registration
# TRANSLATORS:
# %{media_name} is the media name (e.g. SLE-15-Packages),
# %{download_url} is an URL link (e.g. https://download.suse.com)
warning = _("Without registration, update channels will not be\n" \
"configured. This disables updates and security fixes.\n\n" \
"A full system can be installed using the\n" \
"%{media_name} media from %{download_url}.\n" \
"Without these media only a minimum system is available\n" \
"in this installation.") %
{ media_name: "SLE-15-Packages", download_url: "https://download.suse.com" }
if !media_name.empty? && # cannot be nil
!download_url.empty? # cannot be nil
warning += "\n\n" +
_("A full system can be installed using the\n" \
"%{media_name} media from %{download_url}.\n" \
"Without these media only a minimum system is available\n" \
"in this installation.") %
{ media_name: media_name, download_url: download_url }
end

Yast::Popup.Warning(warning)
end

Expand Down
31 changes: 30 additions & 1 deletion test/base_system_registration_dialog_test.rb
Expand Up @@ -154,12 +154,41 @@
end

context "when user skips registration" do
it "does not try to register the system and close the dialog" do
before do
allow(Yast::UI).to receive(:UserInput).and_return(:skip_registration, :next)
end

it "does not try to register the system and close the dialog" do
expect(Yast::Popup).to receive(:Warning).with(/Without registration/)
.and_return(true)
expect(subject.run).to eq(:skip)
end

context "when full_system_media_name and full_system_download_url" \
" is defined in control.xml" do
it "reports the media name and the regarding download url to the user" do
expect(Yast::ProductFeatures).to receive(:GetStringFeature)
.with("globals", "full_system_media_name").and_return("SLE-15-Packages")
expect(Yast::ProductFeatures).to receive(:GetStringFeature)
.with("globals", "full_system_download_url").and_return("https://download.suse.com")
expect(Yast::Popup).to receive(:Warning).with(/SLE-15-Packages.*download.suse.com/)
expect(subject.run).to eq(:skip)
end
end

context "when full_system_media_name and full_system_download_url" \
" is NOT defined in control.xml" do
it "does not mention any media information" do
expect(Yast::ProductFeatures).to receive(:GetStringFeature)
.with("globals", "full_system_media_name").and_return("")
expect(Yast::ProductFeatures).to receive(:GetStringFeature)
.with("globals", "full_system_download_url").and_return("")
expect(Yast::Popup).to receive(:Warning).with(/Without registration/)
.and_return(true)
expect(Yast::Popup).not_to receive(:Warning).with(/Without these media only/)
expect(subject.run).to eq(:skip)
end
end
end
end

Expand Down

0 comments on commit 4bb39c1

Please sign in to comment.