Hello community,
here is the log from the commit of package yast2-installation for
openSUSE:Factory checked in at 2016-08-18 10:20:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-installation (Old)
and /work/SRC/openSUSE:Factory/.yast2-installation.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-installation"
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-installation/yast2-installation.changes
2016-07-24 19:43:24.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.yast2-installation.new/yast2-installation.changes
2016-08-18 10:20:52.000000000 +0200
@@ -1,0 +2,50 @@
+Tue Aug 16 15:34:43 UTC 2016 - [email protected]
+
+- SSH Importer: Width fix to avoid cut of CheckBoxFrame Label
+ (fate##319624)
+- 3.1.209
+
+-------------------------------------------------------------------
+Tue Aug 16 13:28:14 CEST 2016 - [email protected]
+
+- Fixed testsuite for inst_complex_welcome after implementing lazy
+ loading in ProductLicense in yast2-packager (bsc#993285)
+- 3.1.208
+
+-------------------------------------------------------------------
+Fri Aug 5 07:22:59 UTC 2016 - [email protected]
+
+- Fix the registration screen initialization when SCC server
+ is used during self-update (FATE#319716)
+- 3.1.207
+
+-------------------------------------------------------------------
+Thu Aug 4 10:02:28 UTC 2016 - [email protected]
+
+- Retrieve the self-update URL from the registration
+ server (SCC/SMT) (FATE#319716)
+- 3.1.206
+
+-------------------------------------------------------------------
+Wed Aug 3 17:06:46 CEST 2016 - [email protected]
+
+- UI, UX and internal handling for the Welcome screen optimized to
+ prevent from not showing that the license needs to be accepted
+ (bsc#980374).
+- 3.1.205
+
+-------------------------------------------------------------------
+Fri Jul 29 07:32:46 UTC 2016 - [email protected]
+
+- If the user has skipped multipath activation, don't ask again
+ after installer self-update (bsc#989770)
+- 3.1.204
+
+-------------------------------------------------------------------
+Fri Jul 22 13:48:12 UTC 2016 - [email protected]
+
+- Don't halt the installation if installer updates server
+ cannot be reached when using AutoYaST (bsc#988949)
+- 3.1.203
+
+-------------------------------------------------------------------
Old:
----
yast2-installation-3.1.202.tar.bz2
New:
----
yast2-installation-3.1.208.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-installation.spec ++++++
--- /var/tmp/diff_new_pack.pH0frl/_old 2016-08-18 10:20:53.000000000 +0200
+++ /var/tmp/diff_new_pack.pH0frl/_new 2016-08-18 10:20:53.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-installation
-Version: 3.1.202
+Version: 3.1.208
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -38,6 +38,7 @@
BuildRequires: update-desktop-files
BuildRequires: yast2-core-devel
BuildRequires: yast2-devtools >= 3.1.10
+BuildRequires: yast2-packager >= 3.1.113
BuildRequires: rubygem(rspec)
# Moved proc_modules.scr
@@ -62,11 +63,11 @@
# Mouse-related scripts moved to yast2-mouse
Conflicts: yast2-mouse < 2.18.0
-# New API for ProductLicense
-Requires: yast2-packager >= 3.1.96
+# Lazy loading in ProductLicense
+Requires: yast2-packager >= 3.1.113
-# Storage::GetDetectedDiskPaths
-Requires: yast2-storage >= 2.24.1
+# Yast::Storage.multipath_off?
+Requires: yast2-storage >= 3.1.97
# use in startup scripts
Requires: initviocons
@@ -100,6 +101,9 @@
# Top bar with logo
Conflicts: yast2-ycp-ui-bindings < 3.1.7
+# RegserviceSelectionDialog
+Conflicts: yast2-registration < 3.1.179
+
Obsoletes: yast2-installation-devel-doc
# tar-gzip some system files and untar-ungzip them after the installation
(FATE #300421, #120103)
++++++ yast2-installation-3.1.202.tar.bz2 -> yast2-installation-3.1.208.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-installation-3.1.202/doc/SELF_UPDATE.md
new/yast2-installation-3.1.208/doc/SELF_UPDATE.md
--- old/yast2-installation-3.1.202/doc/SELF_UPDATE.md 2016-07-21
14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/doc/SELF_UPDATE.md 2016-08-17
11:06:09.000000000 +0200
@@ -36,7 +36,7 @@
The URL of the update repository is evaluated in this order:
1. The `SelfUpdate` boot option
-2. The AutoYaST control file - in AutoYaST installation only, use the
+2. The AutoYaST profile - in AutoYaST installation only, use the
`/general/self_update_url` XML node:
```xml
@@ -44,7 +44,15 @@
<self_update_url>http://example.com/updates/$arch</self_update_url>
</general>
```
-3. Hard-coded in the `control.xml` file on the installation medium (thus it
+3. Registration server (SCC/SMT), not available in openSUSE. The URL of the
+ registration server which should be used is determined via:
+ 1. AutoYaST profile ([reg_server
element](https://www.suse.com/documentation/sles-12/singlehtml/book_autoyast/book_autoyast.html#CreateProfile.Register)).
+ 2. The `regurl` boot parameter
+ 3. SLP lookup (this behavior applies to regular and AutoYaST installations):
+ * If one server is found, it will be used automatically.
+ * If more than one server is found, it will ask the user to choose one.
+ 4. Default SUSE Customer Center API (`https://scc.suse.com/`).
+4. Hard-coded in the `control.xml` file on the installation medium (thus it
depends on the base product):
```xml
@@ -53,8 +61,10 @@
</globals>
```
-The first found option is used. If no update URL is found then the self update
-is skipped.
+The first suitable URL will be used. There are two exceptions:
+
+* Of course, if no update URL is found then the self update is skipped.
+* If SCC/SMT provides multiple URLs, they will be all used.
The URL can contain a variable `$arch` that will be replaced by the system's
architecture, such as `x86_64`, `s390x`, etc. You can find more information
@@ -62,7 +72,7 @@
### Actual URLs
-The regular update URLs have the form
+When using registration servers, the regular update URLs have the form
`https://updates.suse.com/SUSE/Updates/$PRODUCT/$VERSION/$ARCH/update` where
- PRODUCT is like OpenStack-Cloud, SLE-DESKTOP, SLE-SDK, SLE-SERVER,
- VERSION (for SLE-SERVER) is like 12, 12-SP1,
@@ -101,3 +111,22 @@
way is to store the configuration into an YAML file and load it when
restarting the
installer. See the
[example](https://github.com/yast/yast-installation/pull/367/files#diff-4c91d6424e08c9bef9237f7d959fc0c2R48)
in the `inst_complex_welcome` client.
+
+## Error handling
+
+Errors during the installer update are handled as described below:
+
+* If network is not available, the installer update will be skipped.
+* If the network is configured but the installer updates repository or the
+ registration server are not reachable:
+ * in a regular installation/upgrade, YaST2 will offer the possibility
+ to check/adjust the network configuration.
+ * in an AutoYaST installation/upgrade, a warning will be shown.
+* If the updates repository is found but it is empty or not valid:
+ * in the case that the URL was specified by the user (using the *SelfUpdate*
boot
+ option or through the *self_update_url* element in an AutoYaST profile), an
+ error message will be shown.
+ * if the URL was not specified by the user, the installer will skip the
update
+ process (it will assume that no updates are available).
+* If something goes wrong trying to fetch and apply the update, the user will
be
+ notified.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/package/yast2-installation.changes
new/yast2-installation-3.1.208/package/yast2-installation.changes
--- old/yast2-installation-3.1.202/package/yast2-installation.changes
2016-07-21 14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/package/yast2-installation.changes
2016-08-17 11:06:09.000000000 +0200
@@ -1,4 +1,54 @@
-------------------------------------------------------------------
+Tue Aug 16 15:34:43 UTC 2016 - [email protected]
+
+- SSH Importer: Width fix to avoid cut of CheckBoxFrame Label
+ (fate##319624)
+- 3.1.209
+
+-------------------------------------------------------------------
+Tue Aug 16 13:28:14 CEST 2016 - [email protected]
+
+- Fixed testsuite for inst_complex_welcome after implementing lazy
+ loading in ProductLicense in yast2-packager (bsc#993285)
+- 3.1.208
+
+-------------------------------------------------------------------
+Fri Aug 5 07:22:59 UTC 2016 - [email protected]
+
+- Fix the registration screen initialization when SCC server
+ is used during self-update (FATE#319716)
+- 3.1.207
+
+-------------------------------------------------------------------
+Thu Aug 4 10:02:28 UTC 2016 - [email protected]
+
+- Retrieve the self-update URL from the registration
+ server (SCC/SMT) (FATE#319716)
+- 3.1.206
+
+-------------------------------------------------------------------
+Wed Aug 3 17:06:46 CEST 2016 - [email protected]
+
+- UI, UX and internal handling for the Welcome screen optimized to
+ prevent from not showing that the license needs to be accepted
+ (bsc#980374).
+- 3.1.205
+
+-------------------------------------------------------------------
+Fri Jul 29 07:32:46 UTC 2016 - [email protected]
+
+- If the user has skipped multipath activation, don't ask again
+ after installer self-update (bsc#989770)
+- 3.1.204
+
+-------------------------------------------------------------------
+Fri Jul 22 13:48:12 UTC 2016 - [email protected]
+
+- Don't halt the installation if installer updates server
+ cannot be reached when using AutoYaST (bsc#988949)
+- 3.1.203
+
+-------------------------------------------------------------------
Thu Jul 21 11:52:59 UTC 2016 - [email protected]
- simplify and speed up inst_finish client (bnc#986649)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/package/yast2-installation.spec
new/yast2-installation-3.1.208/package/yast2-installation.spec
--- old/yast2-installation-3.1.202/package/yast2-installation.spec
2016-07-21 14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/package/yast2-installation.spec
2016-08-17 11:06:09.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-installation
-Version: 3.1.202
+Version: 3.1.208
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -34,6 +34,7 @@
Source2: YaST2-Firstboot.service
BuildRequires: docbook-xsl-stylesheets libxslt update-desktop-files
yast2-core-devel
+BuildRequires: yast2-packager >= 3.1.113
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: rubygem(rspec)
@@ -59,11 +60,11 @@
# Mouse-related scripts moved to yast2-mouse
Conflicts: yast2-mouse < 2.18.0
-# New API for ProductLicense
-Requires: yast2-packager >= 3.1.96
+# Lazy loading in ProductLicense
+Requires: yast2-packager >= 3.1.113
-# Storage::GetDetectedDiskPaths
-Requires: yast2-storage >= 2.24.1
+# Yast::Storage.multipath_off?
+Requires: yast2-storage >= 3.1.97
# use in startup scripts
Requires: initviocons
@@ -97,6 +98,9 @@
# Top bar with logo
Conflicts: yast2-ycp-ui-bindings < 3.1.7
+# RegserviceSelectionDialog
+Conflicts: yast2-registration < 3.1.179
+
Obsoletes: yast2-installation-devel-doc
# tar-gzip some system files and untar-ungzip them after the installation
(FATE #300421, #120103)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/src/lib/installation/clients/inst_complex_welcome.rb
new/yast2-installation-3.1.208/src/lib/installation/clients/inst_complex_welcome.rb
---
old/yast2-installation-3.1.202/src/lib/installation/clients/inst_complex_welcome.rb
2016-07-21 14:47:43.000000000 +0200
+++
new/yast2-installation-3.1.208/src/lib/installation/clients/inst_complex_welcome.rb
2016-08-17 11:06:09.000000000 +0200
@@ -55,6 +55,8 @@
@language = Language.language
@keyboard = ""
+ InstData.product_license_accepted ||= false
+
# ----------------------------------------------------------------------
# Build dialog
# ----------------------------------------------------------------------
@@ -102,7 +104,6 @@
Keyboard.user_decision = true
when :license_agreement
read_ui_state
- InstData.product_license_accepted = @license_accepted
when :language
next if Mode.config
read_ui_state
@@ -142,12 +143,21 @@
end
end
- def initialize_widgets
- Wizard.EnableAbortButton
+ def initialize_license
+ # Showing empty license to prevent from redrawing the dialog when
+ # the translated license is found and shown to the user
+ UI.ReplaceWidget(Id(:base_license_rp), RichText(""))
- UI.ChangeWidget(Id(:language), :Value, @language)
- UI.ChangeWidget(Id(:license_agreement), :Value, @license_accepted)
+ # If accepting the license is required, show the check-box
+ if license_required?
+ UI.ReplaceWidget(:license_checkbox_rp, license_agreement_checkbox)
+ UI.ChangeWidget(Id(:license_agreement), :Value,
InstData.product_license_accepted)
+ end
+ log.info "Acceptance needed: #{@id} => #{license_required?}"
+ end
+
+ def initialize_keyboard_selection
if Keyboard.user_decision
UI.ChangeWidget(Id(:keyboard), :Value, Keyboard.current_kbd)
else
@@ -155,6 +165,18 @@
UI.ChangeWidget(Id(:keyboard), :Value, kbd)
Keyboard.Set(kbd)
end
+ end
+
+ def initialize_widgets
+ UI.BusyCursor
+
+ initialize_license
+
+ Wizard.EnableAbortButton
+
+ UI.ChangeWidget(Id(:language), :Value, @language)
+
+ initialize_keyboard_selection
# In case of going back, Release Notes button may be shown, retranslate
it (bnc#886660)
# Assure that relnotes have been downloaded first
@@ -162,7 +184,13 @@
Wizard.ShowReleaseNotesButton(_("Re&lease Notes..."), "rel_notes")
end
+ # This also shows content of the info file if it exists, so it has to be
+ # called at the very end
+ ProductLicense.ShowLicenseInInstallation(:base_license_rp, @license_id)
+
UI.SetFocus(Id(:language))
+
+ UI.NormalCursor
end
def help_text
@@ -271,7 +299,8 @@
#
# @return [Boolean] true if license was accepted; false otherwise.
def license_accepted?
- license_required? ? UI.QueryWidget(Id(:license_agreement), :Value) : true
+ read_ui_state
+ InstData.product_license_accepted
end
# Determines whether the license is required or not
@@ -289,14 +318,15 @@
end
def read_ui_state
- @language = UI.QueryWidget(Id(:language), :Value)
- @keyboard = UI.QueryWidget(Id(:keyboard), :Value)
- @license_accepted = UI.QueryWidget(Id(:license_agreement), :Value)
+ @language = UI.QueryWidget(Id(:language), :Value)
+ @keyboard = UI.QueryWidget(Id(:keyboard), :Value)
+ InstData.product_license_accepted =
UI.QueryWidget(Id(:license_agreement), :Value)
end
def retranslate_yast
Console.SelectFont(@language)
# no yast translation for nn_NO, use nb_NO as a backup
+ # FIXME: remove the hack, please
if @language == "nn_NO"
log.info "Nynorsk not translated, using Bokm\u00E5l"
Language.WfmSetGivenLanguage("nb_NO")
@@ -325,7 +355,6 @@
def setup_final_choice
Keyboard.Set(@keyboard)
- InstData.product_license_accepted = @license_accepted
# Language has been set already.
# On first run store users decision as default.
@@ -364,7 +393,7 @@
data = {
"language" => @language,
"keyboard" => @keyboard,
- "license_accepted" => @license_accepted
+ "license_accepted" => InstData.product_license_accepted
}
File.write(DATA_PATH, data.to_yaml)
@@ -372,9 +401,9 @@
def apply_data
data = YAML.load(File.read(DATA_PATH))
- @language = data["language"]
- @keyboard = data["keyboard"]
- @license_accepted = data["license_accepted"]
+ @language = data["language"]
+ @keyboard = data["keyboard"]
+ InstData.product_license_accepted = data["license_accepted"]
ProductLicense.info_seen!(@license_id)
change_language
@@ -428,7 +457,7 @@
HBox(
HWeight(1, HStretch()),
HSpacing(3),
- HWeight(1, Left(TextEntry(Id(:keyboard_test), _("K&eyboard
Test"))))
+ HWeight(1, Left(InputField(Id(:keyboard_test), Opt(:hstretch),
_("K&eyboard Test"))))
)
),
VWeight(
@@ -445,7 +474,7 @@
MinWidth(
# BNC #607135
text_mode? ? 85 : 106,
- Left(ReplacePoint(Id(:base_license_rp), Empty()))
+ Left(ReplacePoint(Id(:base_license_rp), Opt(:hstretch),
Empty()))
)
),
VSpacing(text_mode? ? 0.5 : 1),
@@ -484,14 +513,6 @@
)
initialize_widgets
-
- ProductLicense.ShowLicenseInInstallation(:base_license_rp, @license_id)
-
- # If accepting the license is required, show the check-box
- if license_required?
- UI.ReplaceWidget(:license_checkbox_rp, license_agreement_checkbox)
- end
- log.info "Acceptance needed: #{@id} => #{license_required?}"
end
end unless defined? Yast::InstComplexWelcomeClient
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/src/lib/installation/clients/inst_system_analysis.rb
new/yast2-installation-3.1.208/src/lib/installation/clients/inst_system_analysis.rb
---
old/yast2-installation-3.1.202/src/lib/installation/clients/inst_system_analysis.rb
2016-07-21 14:47:43.000000000 +0200
+++
new/yast2-installation-3.1.208/src/lib/installation/clients/inst_system_analysis.rb
2016-08-17 11:06:09.000000000 +0200
@@ -26,15 +26,19 @@
# Lukas Ocilka <[email protected]>
require "yast"
+require "fileutils"
module Yast
class InstSystemAnalysisClient < Client
+ include Yast::Logger
+
def main
Yast.import "UI"
textdomain "installation"
Yast.import "Arch"
+ Yast.import "Directory"
Yast.import "GetInstArgs"
Yast.import "Hotplug"
Yast.import "InstData"
@@ -56,6 +60,8 @@
Yast.include self, "packager/storage_include.rb"
Yast.include self, "packager/load_release_notes.rb"
+ @multipath_off_file = File.join(Directory.vardir, "multipath_off")
+
if Mode.autoupgrade
Report.Import(
@@ -144,6 +150,9 @@
_("YaST is probing computer hardware and installed systems now.")
)
+ # bug#989770
+ Storage.SetMultipathStartup(false) if persisted_multipath_off?
+
actions_functions.each do |run_function|
Progress.NextStage
# Bugzilla #298049
@@ -165,6 +174,12 @@
end
Installation.probing_done = true
+ # bug#989770
+ if Storage.multipath_off?
+ log.info "The user decided to not activate multipath"
+ persist_multipath_off
+ end
+
# the last step is hidden
return :abort if ProductProfile.CheckCompliance(nil) == false
@@ -355,5 +370,22 @@
true
end
+
+ protected
+
+ # Sets a mark for the installer (in case it's executed again due to
+ # self-update) to disable multipath without asking the user
+ def persist_multipath_off
+ log.info "Multipath activation pop-up will be skipped if installer
restarts"
+ ::FileUtils.touch(@multipath_off_file)
+ end
+
+ # Checks if #persist_multipath_off was called in the previous execution of
+ # the installer. @see #persist_multipath_off
+ #
+ # @return [Boolean]
+ def persisted_multipath_off?
+ ::File.exist?(@multipath_off_file)
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/src/lib/installation/clients/inst_update_installer.rb
new/yast2-installation-3.1.208/src/lib/installation/clients/inst_update_installer.rb
---
old/yast2-installation-3.1.202/src/lib/installation/clients/inst_update_installer.rb
2016-07-21 14:47:43.000000000 +0200
+++
new/yast2-installation-3.1.208/src/lib/installation/clients/inst_update_installer.rb
2016-08-17 11:06:09.000000000 +0200
@@ -15,6 +15,7 @@
require "installation/updates_manager"
require "uri"
+require "yaml"
module Yast
class InstUpdateInstaller
@@ -23,6 +24,7 @@
UPDATED_FLAG_FILENAME = "installer_updated".freeze
REMOTE_SCHEMES = ["http", "https", "ftp", "tftp", "sftp", "nfs", "nfs4",
"cifs", "smb"].freeze
+ REGISTRATION_DATA_PATH = "/var/lib/YaST2/inst_update_installer.yaml".freeze
Yast.import "Pkg"
Yast.import "GetInstArgs"
@@ -35,13 +37,17 @@
Yast.import "Report"
Yast.import "NetworkService"
Yast.import "Mode"
+ Yast.import "Profile"
def main
textdomain "installation"
return :back if GetInstArgs.going_back
- Installation.finish_restarting! if Installation.restarting?
+ if Installation.restarting?
+ load_registration_url
+ Installation.finish_restarting!
+ end
return :next unless try_to_update?
@@ -55,6 +61,32 @@
end
end
+ # Tries to update the installer
+ #
+ # It also shows feedback to the user in case of error.
+ #
+ # Errors handling:
+ #
+ # * A repository is not found: warn the user if she/he is using
+ # a custom URL.
+ # * Could not fetch update from repository: report the user about
+ # this error.
+ # * Repository could not be probed: suggest checking network
+ # configuration if URL has a REMOTE_SCHEME.
+ #
+ # @return [Boolean] true if installer was updated; false otherwise.
+ def update_installer
+ updated = self_update_urls.map { |u| add_repository(u) }.any?
+
+ if updated
+ log.info("Applying installer updates")
+ updates_manager.apply_all
+ end
+ updated
+ end
+
+ protected
+
# Instantiates an UpdatesManager to be used by the client
#
# The manager is 'memoized'.
@@ -75,44 +107,146 @@
log.info("self-update was disabled through Linuxrc")
false
else
- !self_update_url.nil?
+ !self_update_urls.empty?
end
end
- # Return the self-update URL
+ # Return the self-update URLs
#
- # @return [URI] self-update URL
+ # @return [Array<URI>] self-update URLs
#
+ # @see #default_self_update_url
+ # @see #custom_self_update_url
+ def self_update_urls
+ return @self_update_urls if @self_update_urls
+ @self_update_urls = Array(custom_self_update_url)
+ @self_update_urls = default_self_update_urls if @self_update_urls.empty?
+ log.info("self-update URLs are #{@self_update_urls}")
+ @self_update_urls
+ end
+
+ # Return the default self-update URLs
+ #
+ # A default URL can be specified via SCC/SMT servers or in the control.xml
file.
+ #
+ # @return [Array<URI>] self-update URLs
+ def default_self_update_urls
+ return @default_self_update_urls if @default_self_update_urls
+ @default_self_update_urls = self_update_url_from_connect
+ return @default_self_update_urls unless @default_self_update_urls.empty?
+ @default_self_update_urls = Array(self_update_url_from_control)
+ end
+
+ # Return the custom self-update URL
+ #
+ # A custom URL can be specified via Linuxrc or in an AutoYaST profile.
+ # Only 1 custom self-update URL can be specified.
+ #
+ # @return [URI] self-update URL
# @see #self_update_url_from_linuxrc
- # @see #self_update_url_from_control
# @see #self_update_url_from_profile
- def self_update_url
- url = self_update_url_from_linuxrc || self_update_url_from_profile ||
- self_update_url_from_control
- log.info("self-update URL is #{url}")
- url
+ def custom_self_update_url
+ @custom_self_update_url ||= self_update_url_from_linuxrc ||
self_update_url_from_profile
end
- # Return the self-update URL according to Linuxrc
+ # Return the self-update URLs from SCC/SMT server
#
- # @return [URI,nil] self-update URL. nil if no URL was set in Linuxrc.
- def self_update_url_from_linuxrc
- get_url_from(Linuxrc.InstallInf("SelfUpdate"))
+ # Return an empty array if yast2-registration or SUSEConnect are not
+ # available (for instance in openSUSE). More than 1 URLs can be found.
+ #
+ # As a side effect, it stores the URL of the registration server used
+ # in the installation options.
+ #
+ # @return [Array<URI>] self-update URLs.
+ def self_update_url_from_connect
+ return [] unless require_registration_libraries
+ url = registration_url
+ return [] if url == :cancel
+
+ log.info("Using registration URL: #{url}")
+ import_registration_ayconfig if Mode.auto
+ registration = Registration::Registration.new(url == :scc ? nil :
url.to_s)
+ # Set custom_url into installation options
+ Registration::Storage::InstallationOptions.instance.custom_url =
registration.url
+ store_registration_url(url) if url != :scc
+ registration.get_updates_list.map { |u| URI(u.url) }
+ end
+
+ # Return the URL of the preferred registration server
+ #
+ # Determined in the following order:
+ #
+ # * via AutoYaST profile
+ # * regurl boot parameter
+ # * SLP look up
+ # * If there's only 1 SMT server, it will be chosen automatically.
+ # * If there's more than 1 SMT server, it will ask the user to choose one
+ #
+ # @return [URI,:scc,:cancel] Registration URL; :scc if SCC server was
selected;
+ # :cancel if dialog was dismissed.
+ #
+ # @see #registration_server_from_user
+ def registration_url
+ url = registration_url_from_profile ||
::Registration::UrlHelpers.boot_reg_url
+ return URI(url) if url
+ services = ::Registration::UrlHelpers.slp_discovery
+ return :scc if services.empty?
+ service =
+ if services.size > 1
+ registration_service_from_user(services)
+ else
+ services.first
+ end
+ return service unless service.respond_to?(:slp_url)
+ URI(::Registration::UrlHelpers.service_url(service.slp_url))
+ end
+
+ # Return the registration server URL from the AutoYaST profile
+ #
+ # @return [URI,nil] the self-update URL, nil if not running in AutoYaST
mode
+ # or when the URL is not defined in the profile
+ def registration_url_from_profile
+ return nil unless Mode.auto
+
+ profile = Yast::Profile.current
+ profile_url = profile.fetch("suse_register", {})["reg_server"]
+ get_url_from(profile_url)
+ end
+
+ # Ask the user to chose a registration server
+ #
+ # @param services [Array<SlpServiceClass::Service>] Array of registration
servers
+ # @return [SlpServiceClass::Service,Symbol] Registration service to use;
:scc if SCC is selected;
+ # :cancel if the dialog was
dismissed.
+ def registration_service_from_user(services)
+ ::Registration::UI::RegserviceSelectionDialog.run(
+ services: services,
+ description: _("Select a detected registration server from the list\n"
\
+ "to search for installer updates.")
+ )
end
# Return the self-update URL according to product's control file
#
+ # @return [URI,nil] self-update URL. nil if no URL was set in control file.
def self_update_url_from_control
get_url_from(ProductFeatures.GetStringFeature("globals",
"self_update_url"))
end
+ # Return the self-update URL according to Linuxrc
+ #
+ # @return [URI,nil] self-update URL. nil if no URL was set in Linuxrc.
+ def self_update_url_from_linuxrc
+ get_url_from(Linuxrc.InstallInf("SelfUpdate"))
+ end
+
# Return the self-update URL from the AutoYaST profile
+ #
# @return [URI,nil] the self-update URL, nil if not running in AutoYaST
mode
# or when the URL is not defined in the profile
def self_update_url_from_profile
return nil unless Mode.auto
- Yast.import "Profile"
profile = Yast::Profile.current
profile_url = profile.fetch("general", {})["self_update_url"]
@@ -157,52 +291,42 @@
File.join(Directory.vardir, UPDATED_FLAG_FILENAME)
end
- # Tries to update the installer
- #
- # It also shows feedback to the user in case of error.
+ # Add a repository to the updates manager
#
- # Errors handling:
- #
- # * A repository is not found: warn the user if she/he is using
- # a custom URL.
- # * Could not fetch update from repository: report the user about
- # this error.
- # * Repository could not be probed: suggest checking network
- # configuration if URL has a REMOTE_SCHEME.
- #
- # @return [Boolean] true if installer was updated; false otherwise.
- def update_installer
- log.info("Adding update from #{self_update_url}")
- updates_manager.add_repository(self_update_url)
- updated = updates_manager.repositories?
- if updated
- log.info("Applying installer updates")
- updates_manager.apply_all
- end
- updated
+ # @param url [URI] Repository URL
+ # @return [Boolean] true if the repository was added; false otherwise.
+ def add_repository(url)
+ log.info("Adding update from #{url}")
+ updates_manager.add_repository(url)
rescue ::Installation::UpdatesManager::NotValidRepo
- if !using_default_url?
+ if !default_url?(url)
# TRANSLATORS: %s is an URL
- Report.Error(format(_("A valid update could not be found
at\n%s.\n\n"), self_update_url))
+ Report.Error(format(_("A valid update could not be found
at\n%s.\n\n"), url))
end
false
rescue ::Installation::UpdatesManager::CouldNotFetchUpdateFromRepo
# TRANSLATORS: %s is an URL
- Report.Error(format(_("Could not fetch update from\n%s.\n\n"),
self_update_url))
+ Report.Error(format(_("Could not fetch update from\n%s.\n\n"), url))
false
rescue ::Installation::UpdatesManager::CouldNotProbeRepo
- retry if remote_self_update_url? && configure_network?
+ msg = could_not_probe_repo_msg(url)
+ if Mode.auto
+ Report.Warning(msg)
+ elsif remote_url?(url) && configure_network?(msg)
+ retry
+ end
false
end
# Determine whether the URL is remote
#
+ # @param url [URI] URL to check
# @return [Boolean] true if it's considered remote; false otherwise.
- def remote_self_update_url?
- REMOTE_SCHEMES.include?(self_update_url.scheme)
+ def remote_url?(url)
+ REMOTE_SCHEMES.include?(url.scheme)
end
# Launch the network configuration client on users' demand
@@ -210,24 +334,14 @@
# Ask the user about checking network configuration. If she/he accepts,
# the `inst_lan` client will be launched.
#
+ # @param url [URI] URL to show in the message
# @return [Boolean] true if the network configuration client was launched;
# false if the network is not configured.
- def configure_network?
- if Popup.YesNo(
- # Note: the proxy cannot be configured in the YaST installer yet,
- # it needs to be set via the "proxy" boot option.
- # TRANSLATORS: %s is an URL
- format(_("Downloading the optional installer updates from
\n%s\nfailed.\n" \
- "\n" \
- "You can continue the installation without applying the
updates.\n" \
- "However, some potentially important bug fixes might be
missing.\n" \
- "\n" \
- "If you need a proxy server to access the update
repository\n" \
- "then use the \"proxy\" boot parameter.\n" \
- "\n" \
- "Would you like to check your network configuration\n" \
- "and try installing the updates again?"), self_update_url)
- )
+ def configure_network?(reason)
+ msg = reason + _("\nWould you like to check your network
configuration\n" \
+ "and try installing the updates again?")
+
+ if Popup.YesNo(msg)
Yast::WFM.CallFunction("inst_lan", [{ "skip_detection" => true }])
true
else
@@ -255,8 +369,70 @@
# Determines whether the given URL is equal to the default one
#
# @return [Boolean] true if it's the default URL; false otherwise.
- def using_default_url?
- self_update_url_from_control == self_update_url
+ def default_url?(uri)
+ default_self_update_urls.include?(uri)
+ end
+
+ # Return a message to be shown when the updates repo could not be probed
+ #
+ # @param [URI,String] Repository URI
+ # @return [String] Message including the repository URL
+ #
+ # @see #self_update_url
+ def could_not_probe_repo_msg(url)
+ # Note: the proxy cannot be configured in the YaST installer yet,
+ # it needs to be set via the "proxy" boot option.
+ # TRANSLATORS: %s is an URL
+ format(_("Downloading the optional installer updates from
\n%s\nfailed.\n" \
+ "\n" \
+ "You can continue the installation without applying the updates.\n" \
+ "However, some potentially important bug fixes might be missing.\n" \
+ "\n" \
+ "If you need a proxy server to access the update repository\n" \
+ "then use the \"proxy\" boot parameter.\n"), url.to_s)
+ end
+
+ # Require registration libraries
+ #
+ # @raise LoadError
+ def require_registration_libraries
+ require "registration/url_helpers"
+ require "registration/registration"
+ require "registration/ui/regservice_selection_dialog"
+ true
+ rescue LoadError
+ log.info "yast2-registration is not available"
+ false
+ end
+
+ # Store URL of registration server to be used by inst_scc client
+ #
+ # @params [URI] Registration server URL.
+ def store_registration_url(url)
+ data = { "custom_url" => url.to_s }
+ File.write(REGISTRATION_DATA_PATH, data.to_yaml)
+ end
+
+ # Load URL of registration server to be used by inst_scc client
+ #
+ # @return [Boolean] true if data was loaded; false otherwise.
+ def load_registration_url
+ return false unless File.exist?(REGISTRATION_DATA_PATH) &&
require_registration_libraries
+ data = YAML.load(File.read(REGISTRATION_DATA_PATH))
+ Registration::Storage::InstallationOptions.instance.custom_url =
data["custom_url"]
+ ::FileUtils.rm_rf(REGISTRATION_DATA_PATH)
+ true
+ end
+
+ # Load registration configuration from AutoYaST profile
+ #
+ # This data will be used by
Registration::ConnectHelpers.catch_registration_errors.
+ #
+ # @see Yast::Profile.current
+ def import_registration_ayconfig
+ ::Registration::Storage::Config.instance.import(
+ Yast::Profile.current.fetch("suse_register", {})
+ )
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/src/lib/installation/clients/ssh_import_auto.rb
new/yast2-installation-3.1.208/src/lib/installation/clients/ssh_import_auto.rb
---
old/yast2-installation-3.1.202/src/lib/installation/clients/ssh_import_auto.rb
2016-07-21 14:47:43.000000000 +0200
+++
new/yast2-installation-3.1.208/src/lib/installation/clients/ssh_import_auto.rb
2016-08-17 11:06:09.000000000 +0200
@@ -15,6 +15,10 @@
attr_accessor :changed
end
+ def initialize
+ textdomain "installation"
+ end
+
def run
progress_orig = Yast::Progress.set(false)
ret = super
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/src/lib/installation/dialogs/ssh_import.rb
new/yast2-installation-3.1.208/src/lib/installation/dialogs/ssh_import.rb
--- old/yast2-installation-3.1.202/src/lib/installation/dialogs/ssh_import.rb
2016-07-21 14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/src/lib/installation/dialogs/ssh_import.rb
2016-08-17 11:06:09.000000000 +0200
@@ -62,23 +62,30 @@
end
def dialog_content
+ label = _("I would like to import SSH keys from a previous installation")
HSquash(
VBox(
- CheckBoxFrame(
- Id(:import_ssh_key),
- _("I would like to import SSH keys from a previous installation"),
- !(importer.device.nil? || importer.device.empty?),
- VBox(
- HStretch(),
- VSpacing(1),
- HBox(
- HSpacing(2),
- Mode.config ? device_name : partitions_list_widget
- ),
- VSpacing(3),
- HBox(
- HSpacing(2),
- Left(copy_config_widget)
+ # For some reason the CheckBoxFrame Label is cut if the label size
+ # exceeds the CheckBoxFrame content's width. MinWidth with label
length
+ # is used to avoid this issue.
+ MinWidth(
+ label.length,
+ CheckBoxFrame(
+ Id(:import_ssh_key),
+ label,
+ !(importer.device.nil? || importer.device.empty?),
+ VBox(
+ HStretch(),
+ VSpacing(1),
+ HBox(
+ HSpacing(2),
+ Mode.config ? device_name : partitions_list_widget
+ ),
+ VSpacing(3),
+ HBox(
+ HSpacing(2),
+ Left(copy_config_widget)
+ )
)
)
),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/src/lib/installation/update_repository.rb
new/yast2-installation-3.1.208/src/lib/installation/update_repository.rb
--- old/yast2-installation-3.1.202/src/lib/installation/update_repository.rb
2016-07-21 14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/src/lib/installation/update_repository.rb
2016-08-17 11:06:09.000000000 +0200
@@ -49,7 +49,7 @@
# @return [Array<Pathname>] local paths of updates fetched from the repo
attr_reader :update_files
- # A valid repository was not found (altough the URL exists,
+ # A valid repository was not found (although the URL exists,
# repository type cannot be determined).
class NotValidRepo < StandardError; end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/src/lib/installation/updates_manager.rb
new/yast2-installation-3.1.208/src/lib/installation/updates_manager.rb
--- old/yast2-installation-3.1.202/src/lib/installation/updates_manager.rb
2016-07-21 14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/src/lib/installation/updates_manager.rb
2016-08-17 11:06:09.000000000 +0200
@@ -42,15 +42,18 @@
# @return [Array<DriverUpdate>] Driver updates found in inst-sys
attr_reader :driver_updates
+ # Base exception to be used for repository problems
+ class RepoError < StandardError; end
+
# The URL was found but a valid repo is not there.
- class NotValidRepo < StandardError; end
+ class NotValidRepo < RepoError; end
# The update could not be fetched (missing packages, broken
# repository, etc.).
- class CouldNotFetchUpdateFromRepo < StandardError; end
+ class CouldNotFetchUpdateFromRepo < RepoError; end
# Repo is unreachable (name solving issues, etc.).
- class CouldNotProbeRepo < StandardError; end
+ class CouldNotProbeRepo < RepoError; end
DRIVER_UPDATES_PATHS = [Pathname("/update"), Pathname("/download")].freeze
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/test/inst_complex_welcome_test.rb
new/yast2-installation-3.1.208/test/inst_complex_welcome_test.rb
--- old/yast2-installation-3.1.202/test/inst_complex_welcome_test.rb
2016-07-21 14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/test/inst_complex_welcome_test.rb
2016-08-17 11:06:09.000000000 +0200
@@ -101,6 +101,7 @@
allow(Yast::Language).to receive(:CheckLanguagesSupport)
allow(Yast::ProductLicense).to
receive(:AcceptanceNeeded).and_return(license_needed)
+ allow(Yast::ProductLicense).to
receive(:cache_license_acceptance_needed).and_return(nil)
allow(subject).to
receive(:license_accepted?).and_return(license_accepted)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-installation-3.1.202/test/inst_update_installer_test.rb
new/yast2-installation-3.1.208/test/inst_update_installer_test.rb
--- old/yast2-installation-3.1.202/test/inst_update_installer_test.rb
2016-07-21 14:47:43.000000000 +0200
+++ new/yast2-installation-3.1.208/test/inst_update_installer_test.rb
2016-08-17 11:06:09.000000000 +0200
@@ -2,8 +2,20 @@
require_relative "test_helper"
require "installation/clients/inst_update_installer"
+require "singleton"
describe Yast::InstUpdateInstaller do
+ # Registration::Storage::InstallationOptions fake
+ class FakeInstallationOptions
+ include Singleton
+ attr_accessor :custom_url
+ end
+
+ class FakeRegConfig
+ include Singleton
+ def import(_args); end
+ end
+
Yast.import "Linuxrc"
Yast.import "ProductFeatures"
Yast.import "GetInstArgs"
@@ -20,17 +32,24 @@
let(:network_running) { true }
let(:repo) { double("repo") }
let(:has_repos) { true }
+ let(:restarting) { false }
+ let(:profile) { {} }
+ let(:ay_profile) { double("Yast::Profile", current: profile) }
before do
allow(Yast::Pkg).to receive(:GetArchitecture).and_return(arch)
allow(Yast::Mode).to receive(:auto).and_return(false)
allow(Yast::NetworkService).to
receive(:isNetworkRunning).and_return(network_running)
allow(::Installation::UpdatesManager).to receive(:new).and_return(manager)
- allow(Yast::Installation).to receive(:restarting?)
+ allow(Yast::Installation).to receive(:restarting?).and_return(restarting)
+ allow(Yast::Installation).to receive(:finish_restarting!)
allow(Yast::Installation).to receive(:restart!) { :restart_yast }
+ allow(subject).to
receive(:require).with("registration/url_helpers").and_raise(LoadError)
+ allow(::FileUtils).to receive(:touch)
+ stub_const("Registration::Storage::InstallationOptions",
FakeInstallationOptions)
+ stub_const("Registration::Storage::Config", FakeRegConfig)
# stub the Profile module to avoid dependency on autoyast2-installation
- ay_profile = double("Yast::Profile")
stub_const("Yast::Profile", ay_profile)
end
@@ -93,20 +112,38 @@
end
context "when repository can't be probed" do
+ before do
+ allow(manager).to receive(:add_repository)
+ .and_raise(::Installation::UpdatesManager::CouldNotProbeRepo)
+ end
+
context "and self-update URL is remote" do
it "shows a dialog suggesting to check the network configuration" do
- expect(Yast::Popup).to receive(:YesNo).with(/installer updates
from/)
+ expect(Yast::Popup).to receive(:YesNo)
expect(manager).to receive(:add_repository)
.and_raise(::Installation::UpdatesManager::CouldNotProbeRepo)
expect(subject.main).to eq(:next)
end
+
+ context "in AutoYaST installation or upgrade" do
+ before do
+ allow(Yast::Mode).to receive(:auto).at_least(1).and_return(true)
+ end
+
+ it "shows an error" do
+ expect(Yast::Report).to receive(:Warning)
+ expect(subject.main).to eq(:next)
+ end
+ end
end
context "and self-update URL is not remote" do
let(:url) { "cd:/?device=sr0" }
+
it "shows a dialog suggesting to check the network configuration" do
expect(Yast::Popup).to_not receive(:YesNo)
- expect(manager).to
receive(:add_repository).and_raise(::Installation::UpdatesManager::CouldNotProbeRepo)
+ expect(manager).to receive(:add_repository)
+ .and_raise(::Installation::UpdatesManager::CouldNotProbeRepo)
expect(subject.main).to eq(:next)
end
end
@@ -162,13 +199,180 @@
end
end
+ context "when a SCC/SMT server defines the URL" do
+ let(:smt0) { double("service", slp_url: "http://update.suse.com") }
+ let(:smt1) { double("service", slp_url: "http://update.example.net")
}
+
+ let(:update0) do
+ OpenStruct.new(
+ name: "SLES-12-Installer-Updates-0",
+ url: "http://update.suse.com/updates/sle12/12.2"
+ )
+ end
+
+ let(:update1) do
+ OpenStruct.new(
+ name: "SLES-12-Installer-Updates-1",
+ url: "http://update.suse.com/updates/sles12/12.2"
+ )
+ end
+
+ let(:regservice_selection) { Class.new }
+
+ let(:url_helpers) { double("url_helpers", registration_url:
smt0.slp_url, slp_discovery: []) }
+ let(:regurl) { nil }
+
+ let(:registration) { double("registration", url: smt0.slp_url) }
+ let(:registration_class) { double("registration_class", new:
registration) }
+
+ let(:updates) { [update0, update1] }
+
+ before do
+ # Load registration libraries
+ allow(subject).to
receive(:require).with("registration/url_helpers")
+ .and_return(true)
+ allow(subject).to
receive(:require).with("registration/registration")
+ .and_return(true)
+ allow(subject).to
receive(:require).with("registration/ui/regservice_selection_dialog")
+ .and_return(true)
+ stub_const("Registration::Registration", registration_class)
+ stub_const("Registration::UrlHelpers", url_helpers)
+ stub_const("Registration::UI::RegserviceSelectionDialog",
regservice_selection)
+
+ allow(url_helpers).to receive(:service_url) { |u| u }
+ allow(url_helpers).to receive(:boot_reg_url).and_return(regurl)
+ allow(registration).to
receive(:get_updates_list).and_return(updates)
+ allow(manager).to receive(:add_repository).and_return(true)
+ allow(File).to receive(:write)
+ end
+
+ it "tries to update the installer using the given URL" do
+ expect(manager).to receive(:add_repository).with(URI(update0.url))
+ .and_return(true)
+ expect(manager).to receive(:add_repository).with(URI(update1.url))
+ .and_return(true)
+ expect(subject.main).to eq(:restart_yast)
+ end
+
+ context "when more than one SMT server exist" do
+ before do
+ allow(url_helpers).to receive(:slp_discovery).and_return([smt0,
smt1])
+ end
+
+ context "if the user selects a SMT server" do
+ before do
+ allow(regservice_selection).to receive(:run).and_return(smt0)
+ end
+
+ it "asks that SMT server for the updates URLs" do
+ expect(registration_class).to receive(:new).with(smt0.slp_url)
+ .and_return(registration)
+ allow(manager).to receive(:add_repository)
+ subject.main
+ end
+
+ it "saves the registration URL to be used later" do
+ allow(manager).to receive(:add_repository)
+ expect(FakeInstallationOptions.instance).to
receive(:custom_url=).with(smt0.slp_url)
+ expect(File).to
receive(:write).with(/\/inst_update_installer.yaml\z/,
+ { "custom_url" => smt0.slp_url }.to_yaml)
+ subject.main
+ end
+ end
+
+ context "if user cancels the dialog" do
+ before do
+ allow(regservice_selection).to
receive(:run).and_return(:cancel)
+ allow(manager).to receive(:add_repository) # it will use the
default URL
+ end
+
+ it "does not search for updates" do
+ expect(registration).to_not receive(:get_updates_list)
+ subject.main
+ end
+ end
+
+ context "if users selects the SCC server" do
+ before do
+ allow(regservice_selection).to receive(:run).and_return(:scc)
+ end
+
+ it "asks the SCC server for the updates URLs" do
+ expect(registration_class).to receive(:new).with(nil)
+ .and_return(registration)
+ allow(manager).to receive(:add_repository)
+ subject.main
+ end
+
+ it "does not save the registration URL to be used later" do
+ allow(manager).to receive(:add_repository)
+ allow(registration).to receive(:url).and_return(nil)
+ expect(FakeInstallationOptions.instance).to
receive(:custom_url=).with(nil)
+ expect(File).to_not
receive(:write).with(/inst_update_installer.yaml/, anything)
+ subject.main
+ end
+ end
+
+ context "when a regurl was specified via Linuxrc" do
+ let(:regurl) { "http://regserver.example.net" }
+
+ it "uses the given server" do
+ expect(registration_class).to receive(:new).with(regurl)
+ .and_return(registration)
+ subject.main
+ end
+ end
+ end
+
+ context "when only one SMT server exist" do
+ before do
+ allow(url_helpers).to receive(:slp_discovery).and_return([smt0])
+ end
+
+ it "is selected automatically" do
+ expect(regservice_selection).to_not receive(:run)
+ expect(registration_class).to receive(:new).with(smt0.slp_url)
+ .and_return(registration)
+ subject.main
+ end
+
+ it "saves the registration URL to be used later" do
+ allow(manager).to receive(:add_repository)
+ expect(FakeInstallationOptions.instance).to
receive(:custom_url=).with(smt0.slp_url)
+ expect(File).to
receive(:write).with(/\/inst_update_installer.yaml\z/,
+ { "custom_url" => smt0.slp_url }.to_yaml)
+ subject.main
+ end
+ end
+
+ context "when a registration configuration is specified via AutoYaST
profile" do
+ let(:reg_server_url) { "http://ay.test.example.com/update" }
+ let(:profile) { { "suse_register" => { "reg_server" =>
reg_server_url } } }
+
+ before do
+ allow(Yast::Mode).to receive(:auto).at_least(1).and_return(true)
+ end
+
+ it "uses the given server" do
+ expect(registration_class).to receive(:new).with(reg_server_url)
+ .and_return(registration)
+ subject.main
+ end
+
+ it "imports profile settings into registration configuration" do
+ allow(manager).to receive(:add_repository)
+ expect(FakeRegConfig.instance).to
receive(:import).with(profile["suse_register"])
+ subject.main
+ end
+ end
+ end
+
context "in AutoYaST installation or upgrade" do
let(:profile_url) { "http://ay.test.example.com/update" }
+ let(:profile) { { "general" => { "self_update_url" => profile_url }
} }
before do
expect(Yast::Mode).to receive(:auto).at_least(1).and_return(true)
- allow(Yast::Profile).to receive(:current)
- .and_return("general" => { "self_update_url" => profile_url })
allow(::FileUtils).to receive(:touch)
end
@@ -249,6 +453,48 @@
end
end
+ context "when restarting YaST2" do
+ let(:restarting) { true }
+ let(:data_file_exists) { true }
+ let(:smt_url) { "https://smt.example.net" }
+ let(:registration_libs) { true }
+
+ before do
+ allow(File).to receive(:exist?)
+ allow(File).to receive(:exist?).with(/\/inst_update_installer.yaml\z/)
+ .and_return(data_file_exists)
+ allow(subject).to receive(:require_registration_libraries)
+ .and_return(registration_libs)
+ allow(File).to
receive(:exist?).with(/installer_updated/).and_return(true)
+ end
+
+ context "and data file is available" do
+ it "sets custom_url" do
+ allow(File).to receive(:read).and_return("---\ncustom_url:
#{smt_url}\n")
+ expect(FakeInstallationOptions.instance).to receive(:custom_url=)
+ .with(smt_url)
+ subject.main
+ end
+ end
+
+ context "and data file is not available" do
+ let(:data_file_exists) { false }
+
+ it "does not set custom_url" do
+ expect(FakeInstallationOptions.instance).to_not receive(:custom_url=)
+ subject.main
+ end
+ end
+
+ context "and yast2-registration is not available" do
+ let(:registration_libs) { false }
+
+ it "does not load custom_url" do
+ expect(FakeInstallationOptions.instance).to_not receive(:custom_url=)
+ subject.main
+ end
+ end
+ end
end
describe "#update_installer" do
@@ -257,12 +503,13 @@
before do
allow(Yast::Linuxrc).to
receive(:InstallInf).with("Insecure").and_return(insecure)
- allow(Yast::Linuxrc).to
receive(:InstallInf).with("SelfUpdate").and_return("1")
+ allow(Yast::Linuxrc).to receive(:InstallInf).with("SelfUpdate")
+ .and_return(url)
end
context "when update works" do
it "returns true" do
- allow(manager).to receive(:add_repository).and_return([repo])
+ allow(manager).to receive(:add_repository).and_return(true)
allow(manager).to receive(:apply_all)
expect(subject.update_installer).to eq(true)
end