Hello community,
here is the log from the commit of package yast2-installation for openSUSE:Factory checked in at 2016-06-13 21:50:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-06-02 12:49:45.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-installation.new/yast2-installation.changes 2016-06-13 21:50:10.000000000 +0200
@@ -1,0 +2,13 @@
+Thu Jun 2 11:09:33 UTC 2016 - schubi@suse.de
+
+- Adapt AutoYaST to support import of SSH server keys/configuration
+ (fate#319624)
+- 3.1.193
+
+-------------------------------------------------------------------
+Thu Jun 2 10:09:33 UTC 2016 - igonzalezsosa@suse.com
+
+- Drop yast2-installation-devel-doc package (fate#320356)
+- 3.1.192
+
+-------------------------------------------------------------------
Old:
----
yast2-installation-3.1.191.tar.bz2
New:
----
yast2-installation-3.1.193.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-installation.spec ++++++
--- /var/tmp/diff_new_pack.63GHMG/_old 2016-06-13 21:50:11.000000000 +0200
+++ /var/tmp/diff_new_pack.63GHMG/_new 2016-06-13 21:50:11.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-installation
-Version: 3.1.191
+Version: 3.1.193
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -100,6 +100,8 @@
# Top bar with logo
Conflicts: yast2-ycp-ui-bindings < 3.1.7
+Obsoletes: yast2-installation-devel-doc
+
# tar-gzip some system files and untar-ungzip them after the installation (FATE #300421, #120103)
Requires: coreutils
Requires: gzip
@@ -133,20 +135,9 @@
BuildArch: noarch
-%package devel-doc
-Requires: yast2-installation >= 2.15.34
-
-PreReq: %fillup_prereq
-
-Summary: YaST2 - Installation Parts
-Group: Documentation/HTML
-
%description
System installation code as present on installation media.
-%description devel-doc
-System installation code as present on installation media.
-
%prep
%setup -n %{name}-%{version}
@@ -234,9 +225,4 @@
%dir %{yast_docdir}
%{yast_docdir}/COPYING
-%files devel-doc
-%defattr(-,root,root)
-%doc %{yast_docdir}
-%exclude %{yast_docdir}/COPYING
-
%changelog
++++++ yast2-installation-3.1.191.tar.bz2 -> yast2-installation-3.1.193.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/SUBDIRS new/yast2-installation-3.1.193/SUBDIRS
--- old/yast2-installation-3.1.191/SUBDIRS 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/SUBDIRS 2016-06-09 17:16:03.000000000 +0200
@@ -1 +1 @@
-src doc startup control autoyast_desktop test
+src startup control autoyast_desktop test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/autoyast_desktop/Makefile.am new/yast2-installation-3.1.193/autoyast_desktop/Makefile.am
--- old/yast2-installation-3.1.191/autoyast_desktop/Makefile.am 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/autoyast_desktop/Makefile.am 2016-06-09 17:16:03.000000000 +0200
@@ -1,7 +1,8 @@
# Makefile.am for installation/src/config
modconfigdir = $(prefix)/share/autoinstall/modules
-modconfig_DATA = deploy_image.desktop
+modconfig_DATA = deploy_image.desktop \
+ ssh_import.desktop
EXTRA_DIST = $(modconfig_DATA)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/autoyast_desktop/ssh_import.desktop new/yast2-installation-3.1.193/autoyast_desktop/ssh_import.desktop
--- old/yast2-installation-3.1.191/autoyast_desktop/ssh_import.desktop 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.193/autoyast_desktop/ssh_import.desktop 2016-06-09 17:16:03.000000000 +0200
@@ -0,0 +1,26 @@
+[Desktop Entry]
+Type=Application
+Categories=Settings;System;Qt;X-SuSE-YaST;X-SuSE-YaST-Misc;
+
+X-KDE-ModuleType=Library
+X-KDE-HasReadOnlyMode=false
+X-SuSE-YaST-Call=ssh_import
+
+X-SuSE-YaST-Group=Security
+X-SuSE-YaST-Argument=
+X-SuSE-YaST-RootOnly=true
+X-SuSE-YaST-AutoInst=configure
+X-SuSE-YaST-Geometry=
+X-SuSE-YaST-SortKey=
+X-SuSE-YaST-AutoInstResource=
+X-SuSE-YaST-AutoInstPath=install
+X-SuSE-YaST-AutoInstSchema=ssh_import.rnc
+X-SuSE-YaST-AutoInstClonable=true
+
+Icon=yast-ssh_import
+Exec=
+
+Name=SSH Key Import
+GenericName=Importing SSH keys from a previous installation
+
+StartupNotify=true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/doc/Makefile.am new/yast2-installation-3.1.193/doc/Makefile.am
--- old/yast2-installation-3.1.191/doc/Makefile.am 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/doc/Makefile.am 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-SUBDIRS = autodocs
-
-doc_DATA = *.html
-
-EXTRA_DIST = $(doc_DATA)
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/doc/SELF_UPDATE.md new/yast2-installation-3.1.193/doc/SELF_UPDATE.md
--- old/yast2-installation-3.1.191/doc/SELF_UPDATE.md 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/doc/SELF_UPDATE.md 2016-06-09 17:16:03.000000000 +0200
@@ -60,6 +60,23 @@
architecture, such as `x86_64`, `s390x`, etc. You can find more information
in the [Arch module](http://www.rubydoc.info/github/yast/yast-yast2/Yast/ArchClass).
+### Actual URLs
+
+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,
+- ARCH is one of aarch64 i586 ia64 ppc ppc64 ppc64le s390x x86_64
+
+For the self-update the *PRODUCT* is replaced
+with *PRODUCT*-INSTALLER, producing these repository paths
+under https://updates.suse.com/
+- /SUSE/Updates/SLE-DESKTOP-INSTALLER/12-SP2/x86_64/update
+- /SUSE/Updates/SLE-SERVER-INSTALLER/12-SP2/aarch64/update
+- /SUSE/Updates/SLE-SERVER-INSTALLER/12-SP2/ppc64le/update
+- /SUSE/Updates/SLE-SERVER-INSTALLER/12-SP2/s390x/update
+- /SUSE/Updates/SLE-SERVER-INSTALLER/12-SP2/x86_64/update
+
## Security
Updates signatures will be checked by libzypp. If the signature is not
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/doc/autodocs/Makefile.am new/yast2-installation-3.1.193/doc/autodocs/Makefile.am
--- old/yast2-installation-3.1.191/doc/autodocs/Makefile.am 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/doc/autodocs/Makefile.am 1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-# Makefile.am for y2m_inst/doc/autodocs
-
-include $(top_srcdir)/autodocs-ycp.ami
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/package/yast2-installation.changes new/yast2-installation-3.1.193/package/yast2-installation.changes
--- old/yast2-installation-3.1.191/package/yast2-installation.changes 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/package/yast2-installation.changes 2016-06-09 17:16:03.000000000 +0200
@@ -1,4 +1,17 @@
-------------------------------------------------------------------
+Thu Jun 2 11:09:33 UTC 2016 - schubi@suse.de
+
+- Adapt AutoYaST to support import of SSH server keys/configuration
+ (fate#319624)
+- 3.1.193
+
+-------------------------------------------------------------------
+Thu Jun 2 10:09:33 UTC 2016 - igonzalezsosa@suse.com
+
+- Drop yast2-installation-devel-doc package (fate#320356)
+- 3.1.192
+
+-------------------------------------------------------------------
Wed Jun 1 11:41:27 UTC 2016 - igonzalezsosa@suse.com
- When importing SSH keys/configuration, only regular files
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/package/yast2-installation.spec new/yast2-installation-3.1.193/package/yast2-installation.spec
--- old/yast2-installation-3.1.191/package/yast2-installation.spec 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/package/yast2-installation.spec 2016-06-09 17:16:03.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-installation
-Version: 3.1.191
+Version: 3.1.193
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -97,6 +97,8 @@
# Top bar with logo
Conflicts: yast2-ycp-ui-bindings < 3.1.7
+Obsoletes: yast2-installation-devel-doc
+
# tar-gzip some system files and untar-ungzip them after the installation (FATE #300421, #120103)
Requires: tar gzip
Requires: coreutils
@@ -129,20 +131,9 @@
BuildArch: noarch
-%package devel-doc
-Group: Documentation/HTML
-Requires: yast2-installation >= 2.15.34
-
-PreReq: %fillup_prereq
-
-Summary: YaST2 - Installation Parts
-
%description
System installation code as present on installation media.
-%description devel-doc
-System installation code as present on installation media.
-
%prep
%setup -n %{name}-%{version}
@@ -230,8 +221,3 @@
%dir %{yast_docdir}
%{yast_docdir}/COPYING
-
-%files devel-doc
-%defattr(-,root,root)
-%doc %{yast_docdir}
-%exclude %{yast_docdir}/COPYING
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/Makefile.am new/yast2-installation-3.1.193/src/Makefile.am
--- old/yast2-installation-3.1.191/src/Makefile.am 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/src/Makefile.am 2016-06-09 17:16:03.000000000 +0200
@@ -68,6 +68,7 @@
clients/save_hw_status_finish.rb \
clients/snapshots_finish.rb \
clients/ssh_import_proposal.rb \
+ clients/ssh_import_auto.rb \
clients/ssh_settings_finish.rb \
clients/stroj-casu.rb \
clients/switch_scr_finish.rb \
@@ -122,6 +123,7 @@
lib/installation/ssh_config.rb \
lib/installation/ssh_key.rb \
lib/installation/ssh_config_file.rb \
+ lib/installation/ssh_importer_presenter.rb \
lib/installation/ssh_importer.rb
ylibtransferdir = "${yast2dir}/lib/transfer"
@@ -189,6 +191,7 @@
lib/installation/clients/umount_finish.rb \
lib/installation/clients/update_wizard_steps.rb \
lib/installation/clients/x11_finish.rb \
+ lib/installation/clients/ssh_import_auto.rb \
lib/installation/clients/yast_inf_finish.rb
ylibdialogdir = "${yast2dir}/lib/installation/dialogs"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/clients/ssh_import_auto.rb new/yast2-installation-3.1.193/src/clients/ssh_import_auto.rb
--- old/yast2-installation-3.1.191/src/clients/ssh_import_auto.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.193/src/clients/ssh_import_auto.rb 2016-06-09 17:16:03.000000000 +0200
@@ -0,0 +1,3 @@
+require "installation/clients/ssh_import_auto"
+
+::Installation::SSHImportAutoClient.run
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/clients/ssh_import_auto.rb new/yast2-installation-3.1.193/src/lib/installation/clients/ssh_import_auto.rb
--- old/yast2-installation-3.1.191/src/lib/installation/clients/ssh_import_auto.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.193/src/lib/installation/clients/ssh_import_auto.rb 2016-06-09 17:16:03.000000000 +0200
@@ -0,0 +1,154 @@
+require "yast"
+
+require "installation/auto_client"
+require "installation/ssh_importer"
+require "installation/ssh_importer_presenter"
+
+Yast.import "Progress"
+Yast.import "Mode"
+Yast.import "Popup"
+
+module Installation
+ # AutoYaST client for ssh_import
+ class SSHImportAutoClient < ::Installation::AutoClient
+ class << self
+ attr_accessor :changed
+ end
+
+ def run
+ progress_orig = Yast::Progress.set(false)
+ ret = super
+ Yast::Progress.set(progress_orig)
+
+ ret
+ end
+
+ # Importing data from the AutoYaST configuration module
+ # AutoYaST data format:
+ #
+ #
+ # <import config:type="boolean">true</import>
+ # true
+ # <device>/dev/sda4</device>
+ #
+ #
+ # @param data [Hash] AutoYaST specification.
+ # @option data [Boolean] :import Import SSH keys
+ # @option data [Boolean] :copy_config Import SSH server configuration
+ # in addition to keys.
+ # @option data [Boolean] :device Device to import the keys/configuration from.
+ def import(data)
+ if !data["import"]
+ log.info "Do not import ssh keys/configuration"
+ ssh_importer.device = nil # do not copy ssh keys into the installed system
+ return true
+ end
+
+ log.info "Importing AutoYaST data: #{data}"
+ ssh_importer.copy_config = data["copy_config"] == true
+ if data["device"] && !data["device"].empty?
+ if ssh_importer.configurations.key?(data["device"])
+ ssh_importer.device = data["device"]
+ else
+ Yast::Report.Warning(
+ # TRANSLATORS: both %s are device names like /dev/sda0
+ _(format("Device %s not found. Using data from %s.",
+ data["device"], ssh_importer.device)))
+ end
+ end
+ true
+ end
+
+ # Returns a human readable summary
+ #
+ # @see ::Installation::SshImporterPresenter
+ def summary
+ ::Installation::SshImporterPresenter.new(ssh_importer).summary
+ end
+
+ def modified?
+ self.class.changed
+ end
+
+ def modified
+ self.class.changed = true
+ end
+
+ def reset
+ ssh_importer.reset
+ end
+
+ def change
+ # If this module has been called and do not
+ # depends on the installed system we would like to
+ # have this section in the exported AutoYaST file
+ # regardless if the entries have been changed nor not.
+ modified
+
+ begin
+ args = {
+ "enable_back" => false,
+ "enable_next" => false,
+ "going_back" => false
+ }
+ Yast::Wizard.OpenAcceptDialog
+ WFM.CallFunction("inst_ssh_import", [args])
+ ensure
+ Yast::Wizard.CloseDialog
+ end
+ end
+
+ # Exporting data to the AutoYaST configuration module.
+ # That's are default entries.
+ def export
+ ret = {}
+ if Mode.config
+ # Taking values from AutoYast configuration module
+ if ssh_importer.device && !ssh_importer.device.empty?
+ ret["import"] = true
+ ret["copy_config"] = ssh_importer.copy_config
+ if !ssh_importer.device.empty? && ssh_importer.device != "default"
+ ret["device"] = ssh_importer.device
+ end
+ else
+ ret["import"] = false
+ ret["copy_config"] = false
+ end
+ else
+ # Taking default values
+ ret = { "import" => true, "copy_config" => false }
+ # Device will not be set because it is optional and the
+ # most-recently-accessed device (biggest keys_atime)
+ # will be used for.
+ # ret["device"] = device
+ end
+ ret
+ end
+
+ # Writes the SSH keys from the selected device (and also other
+ # configuration files if #copy_config? is true) in the target
+ # filesystem
+ def write
+ if Mode.config || Mode.normal # normal=configuration in an installed system
+ Popup.Notify _("It makes no sense to write these settings to system.")
+ true
+ else
+ ssh_importer.write(::Installation.destdir)
+ end
+ end
+
+ def read
+ # It is a user decision only. Not depending on system
+ true
+ end
+
+ protected
+
+ # Helper method to access to the SshImporter
+ #
+ # @return [::Installation::SshImporter] SSH importer
+ def ssh_importer
+ @ssh_importer ||= ::Installation::SshImporter.instance
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/clients/ssh_import_proposal.rb new/yast2-installation-3.1.193/src/lib/installation/clients/ssh_import_proposal.rb
--- old/yast2-installation-3.1.191/src/lib/installation/clients/ssh_import_proposal.rb 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/src/lib/installation/clients/ssh_import_proposal.rb 2016-06-09 17:16:03.000000000 +0200
@@ -1,5 +1,6 @@
require "installation/proposal_client"
require "installation/ssh_importer"
+require "installation/ssh_importer_presenter"
module Yast
# Proposal client for SSH keys import
@@ -37,25 +38,8 @@
end
def preformatted_proposal
- if importer.configurations.empty?
- return Yast::HTML.List([_("No previous Linux installation found")])
- end
- if importer.device.nil?
- res = _("No existing SSH host keys will be copied")
- else
- ssh_config = importer.configurations[importer.device]
- partition = ssh_config.system_name
- if importer.copy_config?
- # TRANSLATORS: %s is the name of a Linux system found in the hard
- # disk, like 'openSUSE 13.2'
- res = _("SSH host keys and configuration will be copied from %s") % partition
- else
- # TRANSLATORS: %s is the name of a Linux system found in the hard
- # disk, like 'openSUSE 13.2'
- res = _("SSH host keys will be copied from %s") % partition
- end
- end
- Yast::HTML.List([res])
+ ::Installation::SshImporterPresenter.new(
+ ::Installation::SshImporter.instance).summary
end
def ask_user(param)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/dialogs/ssh_import.rb new/yast2-installation-3.1.193/src/lib/installation/dialogs/ssh_import.rb
--- old/yast2-installation-3.1.191/src/lib/installation/dialogs/ssh_import.rb 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/src/lib/installation/dialogs/ssh_import.rb 2016-06-09 17:16:03.000000000 +0200
@@ -27,6 +27,7 @@
Yast.import "UI"
Yast.import "Label"
+ Yast.import "Mode"
textdomain "installation"
end
@@ -66,13 +67,13 @@
CheckBoxFrame(
Id(:import_ssh_key),
_("I would like to import SSH keys from a previous installation"),
- true,
+ !(importer.device.nil? || importer.device.empty?),
VBox(
HStretch(),
VSpacing(1),
HBox(
HSpacing(2),
- partitions_list_widget
+ Mode.config ? device_name : partitions_list_widget
),
VSpacing(3),
HBox(
@@ -102,6 +103,11 @@
)
end
+ def device_name
+ # AutoYaST configuration mode. The user can input the device e.b. /dev/sda0
+ TextEntry(Id(:device), _("&Device"), importer.device || "default")
+ end
+
def partitions_list_widget
sorted_partitions = partitions.to_a.sort_by(&:first)
part_widgets = sorted_partitions.map do |device, partition|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/ssh_config.rb new/yast2-installation-3.1.193/src/lib/installation/ssh_config.rb
--- old/yast2-installation-3.1.191/src/lib/installation/ssh_config.rb 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/src/lib/installation/ssh_config.rb 2016-06-09 17:16:03.000000000 +0200
@@ -29,6 +29,7 @@
class SshConfig
extend Yast::I18n
textdomain "installation"
+ include Yast::Logger
class << self
# Creates a new object with the information read from a filesystem
@@ -133,6 +134,8 @@
# @param write_keys [Boolean] whether to copy the keys
# @param write_config_files [Boolean] whether to copy the config files
def write_files(root_dir, write_keys: true, write_config_files: true)
+ log.info "Writing SSH keys and/or configuration: " \
+ "keys: #{write_keys}, config: #{write_config_files}"
dir = self.class.ssh_dir(root_dir)
::FileUtils.mkdir_p(dir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/ssh_config_file.rb new/yast2-installation-3.1.193/src/lib/installation/ssh_config_file.rb
--- old/yast2-installation-3.1.191/src/lib/installation/ssh_config_file.rb 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/src/lib/installation/ssh_config_file.rb 2016-06-09 17:16:03.000000000 +0200
@@ -24,6 +24,8 @@
#
# Used by the SSH configuration importing functionality.
class SshConfigFile
+ include Yast::Logger
+
BACKUP_SUFFIX = ".yast.orig"
# @return [String] file name
@@ -46,12 +48,18 @@
end
def write(dir)
+ log.info "Write SSH config file #{dir} to #{name}"
path = File.join(dir, name)
backup(path)
IO.write(path, content)
File.chmod(permissions, path)
end
+ # Override to_s method for logging.
+ def to_s
+ "#{name}"
+ end
+
protected
def backup(filename)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/ssh_importer.rb new/yast2-installation-3.1.193/src/lib/installation/ssh_importer.rb
--- old/yast2-installation-3.1.191/src/lib/installation/ssh_importer.rb 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/src/lib/installation/ssh_importer.rb 2016-06-09 17:16:03.000000000 +0200
@@ -25,6 +25,7 @@
# in the hard disk and to copy its files to the target system
class SshImporter
include Singleton
+ include Yast::Logger
# @return [String] device name of the source filesystem (i.e. the
# SshConfig to copy the keys from)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/ssh_importer_presenter.rb new/yast2-installation-3.1.193/src/lib/installation/ssh_importer_presenter.rb
--- old/yast2-installation-3.1.191/src/lib/installation/ssh_importer_presenter.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.193/src/lib/installation/ssh_importer_presenter.rb 2016-06-09 17:16:03.000000000 +0200
@@ -0,0 +1,74 @@
+# Copyright (c) 2016 SUSE LLC.
+# All Rights Reserved.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 or 3 of the GNU General
+# Public License as published by the Free Software Foundation.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, contact SUSE LLC.
+
+# To contact SUSE about this file by physical or electronic mail,
+# you may find current contact information at www.suse.com
+
+require "yast"
+
+module Installation
+ # This class is responsible for building a summary for SshImporter
+ # objects. Moving the presentation to a different class, avoid
+ # SshImporter knowing about i18n and HTML.
+ class SshImporterPresenter
+ include Yast::I18n
+
+ # @return [SshImporter] Importer
+ attr_reader :importer
+
+ def initialize(importer)
+ Yast.import "Mode"
+ Yast.import "HTML"
+
+ textdomain "installation"
+ @importer = importer
+ end
+
+ # Build a formatted summary based on the status of the importer
+ #
+ # @return [String] HTML formatted summary.
+ def summary
+ message =
+ if importer.configurations.empty? && (Yast::Mode.installation || Yast::Mode.autoinst)
+ _("No previous Linux installation found")
+ elsif importer.device.nil?
+ _("No existing SSH host keys will be copied")
+ else
+ name = ssh_config.system_name if ssh_config
+ name ||= importer.device || "default"
+ if importer.copy_config?
+ # TRANSLATORS: %s is the name of a Linux system found in the hard
+ # disk, like 'openSUSE 13.2'
+ _("SSH host keys and configuration will be copied from %s") % name
+ else
+ # TRANSLATORS: %s is the name of a Linux system found in the hard
+ # disk, like 'openSUSE 13.2'
+ _("SSH host keys will be copied from %s") % name
+ end
+ end
+ Yast::HTML.List([message])
+ end
+
+ private
+
+ # Helper method to access to SshConfig for the selected device
+ #
+ # @return [::Installation::SshConfig] SSH configuration
+ def ssh_config
+ # TODO: add a method #current_config to SshImporter (?)
+ importer.device ? importer.configurations[importer.device] : nil
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/src/lib/installation/ssh_key.rb new/yast2-installation-3.1.193/src/lib/installation/ssh_key.rb
--- old/yast2-installation-3.1.191/src/lib/installation/ssh_key.rb 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/src/lib/installation/ssh_key.rb 2016-06-09 17:16:03.000000000 +0200
@@ -21,6 +21,7 @@
#
# Used to implement the SSH keys importing functionality.
class SshKey
+ include Yast::Logger
PUBLIC_FILE_SUFFIX = ".pub"
# @return [String] name for the user to identify the key
@@ -42,6 +43,7 @@
end
def write_files(dir)
+ log.info "Write SSH keys to #{dir}:\n#{self}"
files.each do |file|
path = File.join(dir, file.filename)
IO.write(path, file.content)
@@ -49,6 +51,12 @@
end
end
+ # Override to_s method for logging.
+ def to_s
+ "#{name}:\n" +
+ files.collect { |file| " #{file.filename}" }.join("\n")
+ end
+
protected
KeyFile = Struct.new(:filename, :content, :permissions)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/test/Makefile.am new/yast2-installation-3.1.193/test/Makefile.am
--- old/yast2-installation-3.1.191/test/Makefile.am 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/test/Makefile.am 2016-06-09 17:16:03.000000000 +0200
@@ -13,6 +13,7 @@
remote_finish_test.rb \
select_system_role_test.rb \
snapshots_finish_test.rb \
+ ssh_import_auto_test.rb \
updates_manager_test.rb \
update_repository_test.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/test/helpers.rb new/yast2-installation-3.1.193/test/helpers.rb
--- old/yast2-installation-3.1.191/test/helpers.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.193/test/helpers.rb 2016-06-09 17:16:03.000000000 +0200
@@ -0,0 +1,15 @@
+module Helpers
+ # Return path to a fixture directory
+ #
+ # @example Get the base fixtures directory
+ # fixtures_dir #=> FIXTURES_DIR
+ #
+ # @example Get a determined fixture directory
+ # fixtures_dir("fix1") #=> FIXTURES_DIR.join("fix1")
+ #
+ # @param *dirs [Array<String>] Components of path within fixtures directory
+ # @return [Pathname] Pathname to fixture dir
+ def fixtures_dir(*dirs)
+ FIXTURES_DIR.join(*dirs)
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/test/ssh_import_auto_test.rb new/yast2-installation-3.1.193/test/ssh_import_auto_test.rb
--- old/yast2-installation-3.1.191/test/ssh_import_auto_test.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.193/test/ssh_import_auto_test.rb 2016-06-09 17:16:03.000000000 +0200
@@ -0,0 +1,174 @@
+#!/usr/bin/env rspec
+
+require_relative "test_helper"
+require "installation/clients/ssh_import_auto"
+
+describe ::Installation::SSHImportAutoClient do
+ textdomain "installation"
+
+ let(:importer) { ::Installation::SshImporter.instance }
+ let(:mode) { "autoinstallation" }
+ let(:args) { [] }
+
+ before do
+ allow(Yast::WFM).to receive(:Args).and_return([func, args])
+ allow(Yast::Mode).to receive(:mode).and_return(mode)
+ end
+
+ describe "#run" do
+ before do
+ importer.configurations.clear
+ importer.reset
+ end
+
+ context "Export" do
+ let(:func) { "Export" }
+
+ it "returns a hash with default configuration" do
+ expect(subject.run).to eq("copy_config" => false, "import" => true)
+ end
+ end
+
+ context "Summary" do
+ let(:func) { "Summary" }
+ let(:presenter) { double("presenter", summary: "Summary") }
+
+ before do
+ allow(::Installation::SshImporterPresenter).to receive(:new).and_return(presenter)
+ end
+
+ it "returns SSH importer summary" do
+ expect(subject.run).to eq(presenter.summary)
+ end
+ end
+
+ context "Import" do
+ let(:func) { "Import" }
+
+ before do
+ importer.add_config(fixtures_dir("root1"), "dev")
+ end
+
+ context "when importing is disabled" do
+ let(:args) { { "import" => false } }
+
+ it "unset the device" do
+ subject.run
+ expect(importer.device).to be_nil
+ end
+ end
+
+ context "when no device is set" do
+ let(:args) { { "import" => true } }
+
+ it "sets default device to be used" do
+ subject.run
+ expect(importer.device).to eq("dev")
+ end
+ end
+
+ context "when given device exist" do
+ let(:args) { { "import" => true, "device" => "other" } }
+
+ it "sets given device to be used" do
+ importer.add_config(fixtures_dir("root1"), "other")
+ subject.run
+ expect(importer.device).to eq("other")
+ end
+ end
+
+ context "when given device does not exist" do
+ let(:args) { { "import" => true, "device" => "missing" } }
+
+ it "sets default device to be used and warns the user" do
+ expect(Yast::Report).to receive(:Warning)
+ .with(_("Device missing not found. Using data from dev."))
+ subject.run
+ expect(importer.device).to eq("dev")
+ end
+ end
+
+ context "when copying configuration is disabled" do
+ let(:args) { { "import" => true, "copy_config" => false } }
+
+ it "sets copy_config to false" do
+ subject.run
+ expect(importer.copy_config).to eq(false)
+ end
+ end
+
+ context "when copying configuration is enabled" do
+ let(:args) { { "import" => true, "copy_config" => true } }
+
+ it "sets copy_config to true" do
+ subject.run
+ expect(importer.copy_config).to eq(true)
+ end
+ end
+ end
+
+ context "Write" do
+ let(:func) { "Write" }
+
+ before do
+ importer.add_config(fixtures_dir("root1"), "dev")
+ allow(::Installation).to receive(:destdir).and_return("/")
+ end
+
+ it "writes the keys/configuration to the installation directory" do
+ configuration = importer.configurations["dev"]
+ expect(configuration).to receive(:write_files).with("/",
+ write_keys: true, write_config_files: importer.copy_config)
+ subject.run
+ end
+ end
+
+ context "Read" do
+ let(:func) { "Read" }
+
+ it "returns true" do
+ expect(subject.run).to eq(true)
+ end
+ end
+
+ context "Reset" do
+ let(:func) { "Reset" }
+
+ it "resets the importer" do
+ expect(importer).to receive(:reset)
+ subject.run
+ end
+ end
+
+ context "GetModified" do
+ let(:func) { "GetModified" }
+
+ before { described_class.changed = false }
+
+ context "when client was not changed" do
+ it "returns false" do
+ expect(subject.run).to eq(false)
+ end
+ end
+
+ context "when client was changed" do
+ before { subject.modified }
+
+ it "returns true" do
+ expect(subject.run).to eq(true)
+ end
+ end
+ end
+
+ context "SetModified" do
+ let(:func) { "SetModified" }
+
+ before { described_class.changed = false }
+
+ it "sets the client as 'modified'" do
+ expect { subject.run }.to change { subject.modified? }
+ .from(false).to(true)
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/test/ssh_importer_presenter_test.rb new/yast2-installation-3.1.193/test/ssh_importer_presenter_test.rb
--- old/yast2-installation-3.1.191/test/ssh_importer_presenter_test.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.193/test/ssh_importer_presenter_test.rb 2016-06-09 17:16:03.000000000 +0200
@@ -0,0 +1,84 @@
+#!/usr/bin/env rspec
+
+require_relative "test_helper"
+require "installation/ssh_importer_presenter"
+require "installation/ssh_importer"
+
+describe ::Installation::SshImporterPresenter do
+ Yast.import "Mode"
+
+ let(:importer) { ::Installation::SshImporter.instance }
+ let(:presenter) { described_class.new(importer) }
+
+ describe "#summary" do
+ let(:mode) { "installation" }
+ let(:device) { "dev" }
+ let(:copy_config) { false }
+
+ before do
+ importer.configurations.clear
+ importer.reset
+ importer.add_config(FIXTURES_DIR.join(config), "dev")
+ importer.device = device
+ importer.copy_config = copy_config
+ allow(Yast::Mode).to receive(:mode).and_return(mode)
+ end
+
+ context "when no previous configurations were found" do
+ let(:config) { "root3" }
+ let(:device) { nil }
+
+ context "and mode is installation" do
+ let(:mode) { "installation" }
+ let(:message) { _("No previous Linux installation found") }
+
+ it "returns 'No previous Linux...' message" do
+ expect(presenter.summary).to include(message)
+ end
+ end
+
+ context "and mode is autoinstallation" do
+ let(:mode) { "autoinstallation" }
+ let(:message) { _("No previous Linux installation found") }
+
+ it "returns 'No previous Linux...' message" do
+ expect(presenter.summary).to include(message)
+ end
+ end
+
+ context "and mode is not installation or autoinstallation" do
+ let(:mode) { "normal" }
+ let(:message) { _("No existing SSH host keys will be copied") }
+
+ it "returns 'No previous Linux...' message" do
+ expect(presenter.summary).to include(message)
+ end
+ end
+ end
+
+ context "when device is set and copy config is enabled" do
+ let(:config) { "root1" }
+ let(:copy_config) { true }
+ let(:message) do
+ _("SSH host keys and configuration will be copied from %s") %
+ "Operating system 1"
+ end
+
+ it "returns 'SSH host keys and configuration...'" do
+ expect(presenter.summary).to include(message)
+ end
+ end
+
+ context "when device is set and copy config is disabled" do
+ let(:config) { "root1" }
+ let(:message) do
+ _("SSH host keys will be copied from %s") %
+ "Operating system 1"
+ end
+
+ it "returns 'SSH host keys will be copied...'" do
+ expect(presenter.summary).to include(message)
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-3.1.191/test/test_helper.rb new/yast2-installation-3.1.193/test/test_helper.rb
--- old/yast2-installation-3.1.191/test/test_helper.rb 2016-06-01 14:02:48.000000000 +0200
+++ new/yast2-installation-3.1.193/test/test_helper.rb 2016-06-09 17:16:03.000000000 +0200
@@ -5,6 +5,7 @@
require "yast"
require "yast/rspec"
require "pathname"
+require_relative "helpers"
FIXTURES_DIR = Pathname.new(__FILE__).dirname.join("fixtures")
@@ -56,4 +57,5 @@
RSpec.configure do |config|
config.extend Yast::I18n # available in context/describe
config.include Yast::I18n # available in it/let/before/...
+ config.include Helpers # custom helpers
end