Hello community,

here is the log from the commit of package yast2-firstboot for openSUSE:Factory 
checked in at 2020-07-21 15:46:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-firstboot (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-firstboot.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-firstboot"

Tue Jul 21 15:46:38 2020 rev:93 rq:821503 version:4.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-firstboot/yast2-firstboot.changes  
2020-05-09 19:51:24.440715900 +0200
+++ 
/work/SRC/openSUSE:Factory/.yast2-firstboot.new.3592/yast2-firstboot.changes    
    2020-07-21 15:48:30.068155524 +0200
@@ -1,0 +2,6 @@
+Thu Jul 16 09:15:57 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Fix firsboot_hostname client crash (bsc#1173298)
+- 4.3.1
+
+-------------------------------------------------------------------

Old:
----
  yast2-firstboot-4.3.0.tar.bz2

New:
----
  yast2-firstboot-4.3.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-firstboot.spec ++++++
--- /var/tmp/diff_new_pack.1UyVPN/_old  2020-07-21 15:48:31.192156913 +0200
+++ /var/tmp/diff_new_pack.1UyVPN/_new  2020-07-21 15:48:31.196156918 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-firstboot
-Version:        4.3.0
+Version:        4.3.1
 Release:        0
 Summary:        YaST2 - Initial System Configuration
 License:        GPL-2.0-only
@@ -39,9 +39,9 @@
 Requires:       yast2-country >= 2.19.5
 # Rely on the YaST2-Firstboot.service for halting the system on failure
 Requires:       yast2-installation >= 4.1.2
-# Updated DNS API (unneeded write_hostname= method does not exist anymore)
+# Use Yast::Lan.write_config to write hostname changes
 Requires:       yast2-configuration-management >= 4.1.3
-Requires:       yast2-network >= 4.2.14
+Requires:       yast2-network >= 4.3.13
 Requires:       yast2-ruby-bindings >= 1.0.0
 
 # bsc #1165646

++++++ yast2-firstboot-4.3.0.tar.bz2 -> yast2-firstboot-4.3.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-firstboot-4.3.0/.rubocop.yml 
new/yast2-firstboot-4.3.1/.rubocop.yml
--- old/yast2-firstboot-4.3.0/.rubocop.yml      2020-05-07 18:06:03.000000000 
+0200
+++ new/yast2-firstboot-4.3.1/.rubocop.yml      2020-07-17 14:16:51.000000000 
+0200
@@ -1,17 +1,25 @@
 # use the shared YaST defaults
 inherit_from:
-  /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml
+  /usr/share/YaST2/data/devtools/data/rubocop-0.71.0_yast_style.yml
+
+# We need to be sure that everything works fine before enabling it
+Style/FrozenStringLiteralComment:
+  Enabled: false
 
 # Don't enforce any particular name for block params
 SingleLineBlockParams:
   Enabled: false
 
-# Enforce if/unless at the end only for really short lines
-Style/IfUnlessModifier:
-  MaxLineLength: 60
+Metrics/BlockLength:
+  Max: 90
+
+# Configuration parameters: CountComments.
+Metrics/MethodLength:
+  Max: 40
 
 AllCops:
   Exclude:
+    - 'package/*.spec'
     - 'src/modules/**/*'
     - 'src/include/**/*'
     - 'testsuite/**/*'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-firstboot-4.3.0/.yardopts 
new/yast2-firstboot-4.3.1/.yardopts
--- old/yast2-firstboot-4.3.0/.yardopts 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-firstboot-4.3.1/.yardopts 2020-07-17 14:16:51.000000000 +0200
@@ -0,0 +1,7 @@
+--no-private
+--markup markdown
+--protected
+--readme README.md
+--output-dir ./doc/autodocs
+--files *.md
+src/**/*.rb
Binary files old/yast2-firstboot-4.3.0/doc/images/installer_vs_firstboot.png 
and new/yast2-firstboot-4.3.1/doc/images/installer_vs_firstboot.png differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-firstboot-4.3.0/doc/installer_and_firstboot.md 
new/yast2-firstboot-4.3.1/doc/installer_and_firstboot.md
--- old/yast2-firstboot-4.3.0/doc/installer_and_firstboot.md    1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-firstboot-4.3.1/doc/installer_and_firstboot.md    2020-07-17 
14:16:51.000000000 +0200
@@ -0,0 +1,79 @@
+# YaST Installer and First-boot
+
+YaST provides a *first-boot* utility that allows to configure the system 
during the first boot after the installation. That *first-boot* works as an 
installer extensions that guides the user through a series of steps.
+
+Although *first-boot* is conceptually received as an installer extension, this 
part of YaST is frequently forgotten when some re-branding is performed to the 
SUSE/openSUSE installer. Because of that, currently we do not experience a 
similar look&feel when we use the YaST installer and the *first-boot*.
+
+![SLE installer Vs first-boot](images/installer_vs_firstboot.png)
+
+## Layout Configuration
+
+YaST installer allows to tweak the windows layout. Basically it allows to 
show/hide the left sidebar (with the list of installer steps) and the top 
banner. A control file setting is used to configure it:
+
+~~~
+<globals>
+   <installation_ui>sidebar</installation_ui>
+</globals>
+~~~
+
+Currently, YaST only allows to possible layouts:
+
+* Layout including sidebar but without banner (used by openSUSE installer).
+* Layout with banner but without sidebar (used by SLE installer).
+
+YaST does not offer any way to configure each layout element separately, and 
the *sidebar* value must be indicated to activate the openSUSE variant. By 
default, SLE variant is used.
+
+And what about the *first-boot* layout? For the *first-boot* nothing is 
configurable at this moment. YaST always runs the *first-boot* with the 
openSUSE variant (sidebar but no banner).
+
+### Technical details
+
+* To activate the top banner: `UI.SetProductLogo(true)`
+  * Every new wizard will take it into account
+
+* To activate the sidebar: `Wizard.OpenNextBackStepsDialog`
+
+* To not activate the sidebar: `Wizard.OpenNextBackDialog`
+
+See 
https://github.com/yast/yast-installation/blob/master/src/lib/installation/clients/installation.rb#L54.
+
+## Fonts configuration
+
+The YaST installer and the *first-boot* use the same *installer.qss* 
style-sheet provided by [yast-theme](https://github.com/yast/yast-theme) (SLE) 
and [openSUSE/branding](https://github.com/openSUSE/branding) (openSUSE). The 
style-sheet sets the font family to use for different elements (e.g., title of 
dialogs, etc).
+
+Such fonts should be provided to the system in order to use them. In case of 
openSUSE, the package *yast2-qt-branding-openSUSE* requires the fonts as 
dependency, but this does not happen in the *yast2-theme* package used by SLE. 
This makes the SLE installer and *first-boot* to look slightly different 
because they are using different fonts for the dialog title (*Raleway* font is 
not installed in the running system).
+
+Also note that Qt uses the system mono-space font for the `<pre></pre>` blocks 
(e.g., in the rich-text content of the *License Agreement*). To have a similar 
look and feel in the installer and *first-boot*, the mono-space font should be 
set to a specific one. Otherwise, different fonts could be used during 
installation and first boot. It seems that there is no way to force a font 
family for *pre* blocks directly in the *qss* style-sheet.
+
+### Technical details
+
+To configure fonts, YaST could provide a *fontconfig* file and then use it 
only during installation and *first-boot*.
+
+For example, let's say YaST provides the file 
*/usr/share/YaST2/theme/current/fonts/fonts.conf* with the following content:
+
+~~~
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+
+<fontconfig>
+  <alias>
+    <family>monospace</family>
+    <prefer><family>Source Code Pro</family></prefer>
+  </alias>
+</fontconfig>
+~~~
+
+and then, during the installation and *first-boot*, YaST configures the env 
variable *FONTCONFIG_PATH*:
+
+~~~
+FONTCONFIG_PATH=/usr/share/YaST2/theme/current/fonts
+~~~
+
+With that, the *Source Code Pro* font would be use in both cases and it would 
not affect to the target/running system.
+
+## Next Steps
+
+* Decide whether to allow to configure banner and sidebar separately.
+
+* Decide whether to use the same layout for installer and *first-boot*.
+
+* Decide whether to configure mono-space system fonts during installation and 
*first-boot*.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/package/yast2-firstboot.changes 
new/yast2-firstboot-4.3.1/package/yast2-firstboot.changes
--- old/yast2-firstboot-4.3.0/package/yast2-firstboot.changes   2020-05-07 
18:06:03.000000000 +0200
+++ new/yast2-firstboot-4.3.1/package/yast2-firstboot.changes   2020-07-17 
14:16:51.000000000 +0200
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Thu Jul 16 09:15:57 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Fix firsboot_hostname client crash (bsc#1173298)
+- 4.3.1
+
+-------------------------------------------------------------------
 Thu May  7 11:05:20 UTC 2020 - Josef Reidinger <[email protected]>
 
 - Autoyast schema: Allow optional types for string and map objects
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-firstboot-4.3.0/package/yast2-firstboot.spec 
new/yast2-firstboot-4.3.1/package/yast2-firstboot.spec
--- old/yast2-firstboot-4.3.0/package/yast2-firstboot.spec      2020-05-07 
18:06:03.000000000 +0200
+++ new/yast2-firstboot-4.3.1/package/yast2-firstboot.spec      2020-07-17 
14:16:51.000000000 +0200
@@ -16,7 +16,7 @@
 #
 
 Name:           yast2-firstboot
-Version:        4.3.0
+Version:        4.3.1
 Release:        0
 Summary:        YaST2 - Initial System Configuration
 Group:          System/YaST
@@ -38,8 +38,8 @@
 Requires:       yast2-country >= 2.19.5
 # Rely on the YaST2-Firstboot.service for halting the system on failure
 Requires:       yast2-installation >= 4.1.2
-# Updated DNS API (unneeded write_hostname= method does not exist anymore)
-Requires:       yast2-network >= 4.2.14
+# Use Yast::Lan.write_config to write hostname changes
+Requires:       yast2-network >= 4.3.13
 Requires:       yast2-ruby-bindings >= 1.0.0
 Requires:       yast2-configuration-management >= 4.1.3
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-firstboot-4.3.0/src/Makefile.am 
new/yast2-firstboot-4.3.1/src/Makefile.am
--- old/yast2-firstboot-4.3.0/src/Makefile.am   2020-05-07 18:06:03.000000000 
+0200
+++ new/yast2-firstboot-4.3.1/src/Makefile.am   2020-07-17 14:16:51.000000000 
+0200
@@ -45,6 +45,7 @@
 ylibclient_DATA = \
   lib/y2firstboot/clients/configuration_management.rb \
   lib/y2firstboot/clients/firstboot_ssh.rb \
+  lib/y2firstboot/clients/hostname.rb \
   lib/y2firstboot/clients/root.rb \
   lib/y2firstboot/clients/user.rb \
   lib/y2firstboot/clients/licenses.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/src/clients/firstboot_hostname.rb 
new/yast2-firstboot-4.3.1/src/clients/firstboot_hostname.rb
--- old/yast2-firstboot-4.3.0/src/clients/firstboot_hostname.rb 2020-05-07 
18:06:03.000000000 +0200
+++ new/yast2-firstboot-4.3.1/src/clients/firstboot_hostname.rb 2020-07-17 
14:16:51.000000000 +0200
@@ -1,144 +1,3 @@
-# encoding: utf-8
+require "y2firstboot/clients/hostname"
 
-#***************************************************************************
-#
-# Copyright (c) 2015 SUSE LLC
-# All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of version 2 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 Novell, Inc.
-#
-# To contact SUSE about this file by physical or electronic mail,
-# you may find current contact information at www.suse.com
-#
-#**************************************************************************
-#
-module Yast
-  # Client to set the hostname during first boot
-  #
-  # This is just a renamed version of InstHostnameClient, which was removed 
from
-  # YaST2-Network when the second stage was removed from the installation
-  # process
-  class FirstbootHostnameClient < Client
-    class << self
-      # @!method valid_dns_proposal=(value)
-      #   @param [Boolean] Whether a valid DNS proposal was done
-      attr_writer :valid_dns_proposal
-
-      # Determines whether a valid DNS proposal was done
-      #
-      # @return [Boolean] Returns true if a DNS proposal was done
-      def valid_dns_proposal
-        @valid_dns_proposal ||= false
-      end
-    end
-
-    def main
-      Yast.import "UI"
-
-      textdomain "firstboot"
-
-      Yast.import "Arch"
-      Yast.import "DNS"
-      Yast.import "Host"
-      Yast.import "NetworkConfig"
-      Yast.import "String"
-      Yast.import "Wizard"
-      Yast.import "ProductControl"
-      Yast.import "ProductFeatures"
-      Yast.import "GetInstArgs"
-
-      Yast.include self, "network/services/dns.rb"
-
-      # only once, do not re-propose if user gets back to this dialog from
-      # the previous screen - bnc#438124
-      if !self.class.valid_dns_proposal
-        DNS.Read # handles NetworkConfig too
-        DNS.ProposeHostname # generate random hostname, if none known so far
-
-        # propose settings
-        DNS.dhcp_hostname = !Arch.is_laptop
-      end
-
-      Wizard.SetDesktopIcon("org.opensuse.yast.DNS")
-      ret = HostnameDialog()
-
-      if ret == :next
-        Host.Read
-        Host.ResolveHostnameToStaticIPs
-        Host.Write
-
-        # do not let Lan override us, #152218
-        self.class.valid_dns_proposal = true
-
-        # In InstHostname writing was delayed to do it with the rest of
-        # network configuration in lan_proposal.
-        # In FirstbootHostname it's probably safer to do it right away.
-        DNS.Write
-      end
-
-      ret
-    end
-
-    def HostnameDialog
-      @has_dhcp = true
-
-      @hn_settings = InitSettings()
-
-      functions = {
-        "init"  => fun_ref(method(:InitHnWidget), "void (string)"),
-        "store" => fun_ref(method(:StoreHnWidget), "void (string, map)"),
-        :abort  => fun_ref(method(:ReallyAbortInst), "boolean ()")
-      }
-      contents = HSquash(
-        # Frame label
-        Frame(
-          _("Hostname and Domain Name"),
-          VBox(
-            Left("HOSTNAME"),
-            Left("DHCP_HOSTNAME")
-          )
-        )
-      )
-
-      ret = CWM.ShowAndRun(
-        "widget_descr"       => @widget_descr_dns,
-        "contents"           => contents,
-        # dialog caption
-        "caption"            => _("Hostname and Domain Name"),
-        "back_button"        => Label.BackButton,
-        "next_button"        => Label.NextButton,
-        "fallback_functions" => functions,
-        "disable_buttons"    => GetInstArgs.enable_back ? [] : ["back_button"]
-      )
-
-      if ret == :next
-        # Pre-populate resolv.conf search list with current domain name
-        # but only if none exists so far
-        current_domain = Ops.get_string(@hn_settings, "DOMAIN", "")
-
-        # Need to modify hn_settings explicitly as SEARCHLIST_S widget
-        # does not exist in this dialog, thus StoreHnWidget won't do it
-        # #438167
-        if DNS.searchlist == [] && current_domain != "site"
-          Ops.set(@hn_settings, "SEARCHLIST_S", current_domain)
-        end
-
-        StoreSettings(@hn_settings)
-      end
-
-      ret
-    end
-  end
-end
-
-Yast::FirstbootHostnameClient.new.main
+Y2Firstboot::Clients::Hostname.new.run
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/src/lib/y2firstboot/clients/configuration_management.rb
 
new/yast2-firstboot-4.3.1/src/lib/y2firstboot/clients/configuration_management.rb
--- 
old/yast2-firstboot-4.3.0/src/lib/y2firstboot/clients/configuration_management.rb
   2020-05-07 18:06:03.000000000 +0200
+++ 
new/yast2-firstboot-4.3.1/src/lib/y2firstboot/clients/configuration_management.rb
   2020-07-17 14:16:51.000000000 +0200
@@ -1,5 +1,3 @@
-# encoding: utf-8
-
 # Copyright (c) [2018] SUSE LLC
 #
 # All Rights Reserved.
@@ -36,6 +34,7 @@
         configurator = 
Y2ConfigurationManagement::Configurators::Base.for(config)
         result = configurator.prepare(reverse: Yast::GetInstArgs.going_back)
         return result unless result == :finish
+
         provision ? :next : :abort
       end
 
@@ -48,6 +47,7 @@
         if 
!Yast::PackageSystem.CheckAndInstallPackages(configurator.packages.fetch("install",
 []))
           return false
         end
+
         Y2ConfigurationManagement::Clients::Provision.new.run
       end
 
@@ -63,8 +63,9 @@
       def config
         current_config = 
Y2ConfigurationManagement::Configurations::Base.current
         return current_config if current_config
+
         settings = Yast::ProductFeatures.GetSection("configuration_management")
-                                        .merge(FIXED_SETTINGS)
+          .merge(FIXED_SETTINGS)
         Y2ConfigurationManagement::Configurations::Base.current =
           Y2ConfigurationManagement::Configurations::Base.import(settings)
       end
@@ -72,6 +73,7 @@
       def configurator
         current_configurator = 
Y2ConfigurationManagement::Configurators::Base.current
         return current_configurator if current_configurator
+
         Y2ConfigurationManagement::Configurators::Base.current =
           Y2ConfigurationManagement::Configurators::Base.for(config)
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/src/lib/y2firstboot/clients/hostname.rb 
new/yast2-firstboot-4.3.1/src/lib/y2firstboot/clients/hostname.rb
--- old/yast2-firstboot-4.3.0/src/lib/y2firstboot/clients/hostname.rb   
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-firstboot-4.3.1/src/lib/y2firstboot/clients/hostname.rb   
2020-07-17 14:16:51.000000000 +0200
@@ -0,0 +1,197 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 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 LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "yast"
+
+Yast.import "UI"
+Yast.import "Arch"
+Yast.import "DNS"
+Yast.import "Host"
+Yast.import "NetworkConfig"
+Yast.import "String"
+Yast.import "Wizard"
+Yast.import "ProductControl"
+Yast.import "ProductFeatures"
+Yast.import "GetInstArgs"
+
+module Y2Firstboot
+  module Clients
+    # Client to set the hostname during first boot
+    #
+    # This is just a renamed version of InstHostnameClient, which was removed 
from
+    # YaST2-Network when the second stage was removed from the installation
+    # process
+    class Hostname < Yast::Client
+      class << self
+        # @!method valid_dns_proposal=(value)
+        #   @param [Boolean] Whether a valid DNS proposal was done
+        attr_writer :valid_dns_proposal
+
+        # Determines whether a valid DNS proposal was done
+        #
+        # @return [Boolean] Returns true if a DNS proposal was done
+        def valid_dns_proposal
+          @valid_dns_proposal ||= false
+        end
+
+        def run
+          new.run
+        end
+      end
+
+      def initialize
+        textdomain "firstboot"
+      end
+
+      def run
+        Yast.include self, "network/services/dns.rb"
+
+        # only once, do not re-propose if user gets back to this dialog from
+        # the previous screen - bnc#438124
+        if !self.class.valid_dns_proposal
+          Lan.Read(:cache) # handles NetworkConfig too
+          propose_hostname
+        end
+
+        Wizard.SetDesktopIcon("org.opensuse.yast.DNS")
+        ret = hostname_dialog
+
+        if ret == :next
+          hostname_to_static_ips if wicked?
+
+          # do not let Lan override us, #152218
+          self.class.valid_dns_proposal = true
+
+          # In InstHostname writing was delayed to do it with the rest of
+          # network configuration in lan_proposal.
+          # In FirstbootHostname it's probably safer to do it right away.
+          write_config
+        end
+
+        ret
+      end
+
+    private
+
+      def hostname_dialog
+        @hn_settings = InitSettings()
+
+        functions = {
+          "init"  => fun_ref(method(:InitHnWidget), "void (string)"),
+          "store" => fun_ref(method(:StoreHnWidget), "void (string, map)"),
+          :abort  => fun_ref(method(:ReallyAbortInst), "boolean ()")
+        }
+        contents = HSquash(
+          # Frame label
+          Frame(
+            _("Hostname and Domain Name"),
+            MarginBox(
+              1,
+              1,
+              VBox(
+                Left("HOSTNAME"),
+                Left("DHCP_HOSTNAME")
+              )
+            )
+          )
+        )
+
+        ret = CWM.ShowAndRun(
+          "widget_descr"       => @widget_descr_dns,
+          "contents"           => contents,
+          # dialog caption
+          "caption"            => _("Hostname"),
+          "back_button"        => Label.BackButton,
+          "next_button"        => Label.NextButton,
+          "fallback_functions" => functions,
+          "disable_buttons"    => GetInstArgs.enable_back ? [] : 
["back_button"]
+        )
+
+        if ret == :next
+          # Pre-populate resolv.conf search list with current domain name
+          # but only if none exists so far
+          current_domain = Ops.get_string(@hn_settings, "DOMAIN", "")
+
+          # Need to modify hn_settings explicitly as SEARCHLIST_S widget
+          # does not exist in this dialog, thus StoreHnWidget won't do it
+          # #438167
+          if DNS.searchlist == [] && current_domain != "site"
+            Ops.set(@hn_settings, "SEARCHLIST_S", current_domain)
+          end
+
+          StoreSettings(@hn_settings)
+        end
+
+        ret
+      end
+
+      # Convenience method to check whether the current backend in use is
+      # wicked or not
+      #
+      # @return [Boolean]
+      def wicked?
+        !!yast_config&.backend?(:wicked)
+      end
+
+      # Convenience method to generate a default hostname
+      def propose_hostname
+        return unless propose_hostname?
+
+        Yast::DNS.static = "linux-#{String.Random(4)}"
+      end
+
+      # Checks whether a default hostname should be proposed or not
+      #
+      # @return [Boolean]
+      def propose_hostname?
+        DNS.static.to_s.empty? || DNS.static == "linux"
+      end
+
+      # Convenience method to add the current hostname as an alias of any
+      # static ip that does not have one
+      #
+      # FIXME: is this correct at all? what if there are multiple static ips
+      # without aliases.
+      def hostname_to_static_ips
+        ips = static_ips.select { |ip| Yast::Host.names(ip).empty? }
+        ips.each { |i| Yast::Host.Update(DNS.hostname, DNS.hostname, i) }
+      end
+
+      # Convenience method to obtain all the configured static ips
+      #
+      # @return [Array<String>]
+      def static_ips
+        ips = yast_config&.connections&.map { |c| c.all_ips.map { |i| 
i.address&.address&.to_s } }
+        (ips || []).flatten.compact
+      end
+
+      # Convenience method to obtain the current network configuration
+      #
+      # @return [Y2Network::Config]
+      def yast_config
+        Yast::Lan.yast_config
+      end
+
+      # Convenience method to write the config changes
+      def write_config
+        Yast::Lan.write_config
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/src/lib/y2firstboot/clients/licenses.rb 
new/yast2-firstboot-4.3.1/src/lib/y2firstboot/clients/licenses.rb
--- old/yast2-firstboot-4.3.0/src/lib/y2firstboot/clients/licenses.rb   
2020-05-07 18:06:03.000000000 +0200
+++ new/yast2-firstboot-4.3.1/src/lib/y2firstboot/clients/licenses.rb   
2020-07-17 14:16:51.000000000 +0200
@@ -1,5 +1,3 @@
-# encoding: utf-8
-
 # Copyright (c) [2019] SUSE LLC
 #
 # All Rights Reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-firstboot-4.3.0/test/test_helper.rb 
new/yast2-firstboot-4.3.1/test/test_helper.rb
--- old/yast2-firstboot-4.3.0/test/test_helper.rb       2020-05-07 
18:06:03.000000000 +0200
+++ new/yast2-firstboot-4.3.1/test/test_helper.rb       2020-07-17 
14:16:51.000000000 +0200
@@ -1,4 +1,4 @@
-srcdir = File.expand_path("../../src", __FILE__)
+srcdir = File.expand_path("../src", __dir__)
 y2dirs = ENV.fetch("Y2DIR", "").split(":")
 ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":")
 
@@ -15,7 +15,7 @@
   end
 
   # for coverage we need to load all ruby files
-  src_location = File.expand_path("../../src", __FILE__)
+  src_location = File.expand_path("../src", __dir__)
   # track all ruby files under src
   SimpleCov.track_files("#{src_location}/**/*.rb")
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/test/y2firstboot/clients/configuration_management_test.rb
 
new/yast2-firstboot-4.3.1/test/y2firstboot/clients/configuration_management_test.rb
--- 
old/yast2-firstboot-4.3.0/test/y2firstboot/clients/configuration_management_test.rb
 2020-05-07 18:06:03.000000000 +0200
+++ 
new/yast2-firstboot-4.3.1/test/y2firstboot/clients/configuration_management_test.rb
 2020-07-17 14:16:51.000000000 +0200
@@ -1,6 +1,4 @@
 #!/usr/bin/env rspec
-# encoding: utf-8
-
 # Copyright (c) [2018] SUSE LLC
 #
 # All Rights Reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/test/y2firstboot/clients/hostname_test.rb 
new/yast2-firstboot-4.3.1/test/y2firstboot/clients/hostname_test.rb
--- old/yast2-firstboot-4.3.0/test/y2firstboot/clients/hostname_test.rb 
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-firstboot-4.3.1/test/y2firstboot/clients/hostname_test.rb 
2020-07-17 14:16:51.000000000 +0200
@@ -0,0 +1,98 @@
+#!/usr/bin/env rspec
+# frozen_string_literal: true
+
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 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 LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "../../test_helper"
+require "y2firstboot/clients/hostname"
+require "y2network/hostname"
+
+describe Y2Firstboot::Clients::Hostname do
+  subject(:client) { described_class.new }
+
+  let(:system_config) do
+    Y2Network::Config.new(interfaces: [], hostname: hostname, source: 
:sysconfig)
+  end
+
+  let(:hostname) { Y2Network::Hostname.new(static: "linux") }
+
+  describe "#run" do
+    let(:wicked) { false }
+
+    before do
+      allow(Yast::Lan).to receive(:Read)
+      allow(client).to receive(:propose_hostname?).and_return(false)
+      Yast::Lan.add_config(:yast, system_config)
+      allow(client).to receive(:hostname_dialog)
+      allow(client).to receive(:write_config)
+      allow(client).to receive(:wicked?).and_return(wicked)
+    end
+
+    context "when run the first time" do
+      it "reads the system network configuration" do
+        expect(Yast::Lan).to receive(:Read).with(:cache)
+
+        client.run
+      end
+
+      context "when the hostname is empty or linux" do
+        it "proposes a linux-XXXX hostname where XXXX is a random base-32 
number" do
+          allow(Yast::String).to receive(:Random).with(4).and_return("u54g")
+          allow(client).to receive(:propose_hostname?).and_call_original
+          expect { client.run }.to change { Yast::DNS.hostname 
}.from("linux").to(/linux-u54g/)
+        end
+      end
+
+      it "runs the dialog to modify the hostname and dhcp_hostname setup" do
+        expect(client).to receive(:hostname_dialog)
+
+        client.run
+      end
+
+      context "when :next is selected in the hostname dialog" do
+        before do
+          allow(client).to receive(:hostname_dialog).and_return(:next)
+        end
+
+        context "and wicked is in use" do
+          let(:wicked) { true }
+
+          it "uses the hostname as an alias to static ips without them" do
+            expect(client).to receive(:hostname_to_static_ips)
+
+            client.run
+          end
+        end
+
+        it "writes the config changes" do
+          expect(client).to receive(:write_config)
+
+          client.run
+        end
+      end
+
+      it "returns the dialog result" do
+        expect(client).to receive(:hostname_dialog).and_return(:whatever)
+
+        expect(client.run).to eql(:whatever)
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-firstboot-4.3.0/test/y2firstboot/clients/licenses_test.rb 
new/yast2-firstboot-4.3.1/test/y2firstboot/clients/licenses_test.rb
--- old/yast2-firstboot-4.3.0/test/y2firstboot/clients/licenses_test.rb 
2020-05-07 18:06:03.000000000 +0200
+++ new/yast2-firstboot-4.3.1/test/y2firstboot/clients/licenses_test.rb 
2020-07-17 14:16:51.000000000 +0200
@@ -1,6 +1,4 @@
 #!/usr/bin/env rspec
-# encoding: utf-8
-
 # Copyright (c) [2019] SUSE LLC
 #
 # All Rights Reserved.


Reply via email to