Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2020-04-05 20:52:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Sun Apr 5 20:52:18 2020 rev:421 rq:790905 version:4.2.65 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2020-03-07 21:36:56.232219428 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.3248/yast2-network.changes 2020-04-05 20:52:21.805114780 +0200 @@ -1,0 +2,40 @@ +Thu Apr 2 11:33:49 UTC 2020 - Imobach Gonzalez Sosa <[email protected]> + +- AutoYaST: Do not try to activate network devices that are already + active in S390 systems (bsc#1163149). Related to jsc#SLE-7396. +- AutoYaST: Allow to use spaces or colons to separate channel IDs + in the "chanids" element. +- 4.2.65 + +------------------------------------------------------------------- +Fri Mar 27 14:30:34 UTC 2020 - Knut Anderssen <[email protected]> + +- Refresh the current system cached network configuration with the + one written avoiding inconsistencies during installation + (bsc#1162987) +- 4.2.64 + +------------------------------------------------------------------- +Thu Mar 19 13:52:31 UTC 2020 - Knut Anderssen <[email protected]> + +- AutoYaST: do not crash when defined dns section whitout hostname + (bsc#1166953) +- AutoYaST: handle the dhcp_hostname option in the dns section + correctly +- 4.2.63 + +------------------------------------------------------------------- +Wed Mar 18 09:42:36 UTC 2020 - Knut Anderssen <[email protected]> + +- Do a reload of configured interfaces when writing the + configuration during a ssh or vnc installation (bsc#1166287) +- 4.2.62 + +------------------------------------------------------------------- +Tue Mar 10 14:29:36 UTC 2020 - Josef Reidinger <[email protected]> + +- Store ip forwarding set during installation to target system + (bsc#1159295) +- 4.2.61 + +------------------------------------------------------------------- Old: ---- yast2-network-4.2.60.tar.bz2 New: ---- yast2-network-4.2.65.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.J21cPR/_old 2020-04-05 20:52:22.313115266 +0200 +++ /var/tmp/diff_new_pack.J21cPR/_new 2020-04-05 20:52:22.313115266 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.2.60 +Version: 4.2.65 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.2.60.tar.bz2 -> yast2-network-4.2.65.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/package/yast2-network.changes new/yast2-network-4.2.65/package/yast2-network.changes --- old/yast2-network-4.2.60/package/yast2-network.changes 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/package/yast2-network.changes 2020-04-02 15:02:55.000000000 +0200 @@ -1,4 +1,44 @@ ------------------------------------------------------------------- +Thu Apr 2 11:33:49 UTC 2020 - Imobach Gonzalez Sosa <[email protected]> + +- AutoYaST: Do not try to activate network devices that are already + active in S390 systems (bsc#1163149). Related to jsc#SLE-7396. +- AutoYaST: Allow to use spaces or colons to separate channel IDs + in the "chanids" element. +- 4.2.65 + +------------------------------------------------------------------- +Fri Mar 27 14:30:34 UTC 2020 - Knut Anderssen <[email protected]> + +- Refresh the current system cached network configuration with the + one written avoiding inconsistencies during installation + (bsc#1162987) +- 4.2.64 + +------------------------------------------------------------------- +Thu Mar 19 13:52:31 UTC 2020 - Knut Anderssen <[email protected]> + +- AutoYaST: do not crash when defined dns section whitout hostname + (bsc#1166953) +- AutoYaST: handle the dhcp_hostname option in the dns section + correctly +- 4.2.63 + +------------------------------------------------------------------- +Wed Mar 18 09:42:36 UTC 2020 - Knut Anderssen <[email protected]> + +- Do a reload of configured interfaces when writing the + configuration during a ssh or vnc installation (bsc#1166287) +- 4.2.62 + +------------------------------------------------------------------- +Tue Mar 10 14:29:36 UTC 2020 - Josef Reidinger <[email protected]> + +- Store ip forwarding set during installation to target system + (bsc#1159295) +- 4.2.61 + +------------------------------------------------------------------- Mon Mar 2 21:01:33 UTC 2020 - Michal Filka <[email protected]> - bsc#1164506 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/package/yast2-network.spec new/yast2-network-4.2.65/package/yast2-network.spec --- old/yast2-network-4.2.60/package/yast2-network.spec 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/package/yast2-network.spec 2020-04-02 15:02:55.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.2.60 +Version: 4.2.65 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/network/clients/save_network.rb new/yast2-network-4.2.65/src/lib/network/clients/save_network.rb --- old/yast2-network-4.2.60/src/lib/network/clients/save_network.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/network/clients/save_network.rb 2020-04-02 15:02:55.000000000 +0200 @@ -79,9 +79,9 @@ ) end - ETC = "/etc/".freeze - SYSCONFIG = "/etc/sysconfig/network/".freeze - NETWORK_MANAGER = "/etc/NetworkManager/".freeze + ETC = "/etc".freeze + SYSCONFIG = "/etc/sysconfig/network".freeze + NETWORK_MANAGER = "/etc/NetworkManager".freeze def CopyConfiguredNetworkFiles return if Mode.autoinst && !NetworkAutoYast.instance.keep_net_config? @@ -96,22 +96,25 @@ { dir: SYSCONFIG, file: "ifcfg-*" }, { dir: SYSCONFIG, file: "ifroute-*" }, { dir: SYSCONFIG, file: "routes" }, - { dir: ETC + "wicked/", file: "common.xml" }, - { dir: ETC, file: DNSClass::HOSTNAME_FILE } + { dir: ::File.join(ETC, "wicked"), file: "common.xml" }, + { dir: ETC, file: DNSClass::HOSTNAME_FILE }, + # Copy sysctl file as network writes there ip forwarding (bsc#1159295) + { dir: ::File.join(ETC, "sysctl.d"), file: "70-yast.conf" } ] # NetworkManager is usually the default in a live installation. Any # configuration applied during the installation should be present in the # target system. if Y2Network::ProposalSettings.instance.network_service == :network_manager - copy_recipes << { dir: NETWORK_MANAGER + "/system-connections/", file: "*" } + copy_recipes << { dir: ::File.join(NETWORK_MANAGER, "system-connections"), file: "*" } end # just copy files copy_recipes.each do |recipe| # can be shell pattern like ifcfg-* - file_pattern = recipe[:dir] + recipe[:file] - copy_to = inst_dir + recipe[:dir] + file_pattern = ::File.join(recipe[:dir], recipe[:file]) + copy_to = ::File.join(inst_dir, recipe[:dir]) + log.info("Processing copy recipe #{file_pattern.inspect}") Dir.glob(file_pattern).each do |file| adjust_for_network_disks(file) if file.include?("ifcfg-") @@ -127,12 +130,12 @@ end end - copy_to = String.Quote(inst_dir + SYSCONFIG) + copy_to = String.Quote(::File.join(inst_dir, SYSCONFIG)) # merge files with default installed by sysconfig ["dhcp", "config"].each do |file| - modified_file = SYSCONFIG + file - dest_file = copy_to + file + modified_file = ::File.join(SYSCONFIG, file) + dest_file = ::File.join(copy_to, file) CFA::GenericSysconfig.merge_files(dest_file, modified_file) end # FIXME: proxy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/network/network_autoyast.rb new/yast2-network-4.2.65/src/lib/network/network_autoyast.rb --- old/yast2-network-4.2.60/src/lib/network/network_autoyast.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/network/network_autoyast.rb 2020-04-02 15:02:55.000000000 +0200 @@ -125,15 +125,20 @@ devices_section = Y2Network::AutoinstProfile::S390DevicesSection .new_from_hashes(profile_devices) connections = Y2Network::Autoinst::S390DevicesReader.new(devices_section).config - connections.each do |conn| + connections.each do |conn| builder = Y2Network::InterfaceConfigBuilder.for(conn.type, config: conn) activator = Y2Network::S390DeviceActivator.for(builder) + if !activator.configured_interface.empty? + log.info "Interface #{activator.configured_interface} is already active. " \ + "Skipping the activation." + next + end + log.info "Created interface #{activator.configured_interface}" if activator.configure rescue RuntimeError => e log.error("An error ocurred when trying to activate the s390 device: #{conn.inspect}") - log.error("Error: #{e.sinpect}") - + log.error("Error: #{e.inspect}") end true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/y2network/autoinst/hostname_reader.rb new/yast2-network-4.2.65/src/lib/y2network/autoinst/hostname_reader.rb --- old/yast2-network-4.2.60/src/lib/y2network/autoinst/hostname_reader.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/y2network/autoinst/hostname_reader.rb 2020-04-02 15:02:55.000000000 +0200 @@ -39,19 +39,33 @@ # @return [Hostname] the imported {Hostname} config def config Y2Network::Hostname.new( - dhcp_hostname: section.dhcp_hostname, - static: section.hostname || default_hostname, + dhcp_hostname: dhcp_hostname_for(section.dhcp_hostname), + static: section.hostname || static_hostname, installer: section.hostname ) end private - # Returns a default hostname proposal for installer + # Returns the current static_hostname # # @return [String] - def default_hostname - Y2Network::Sysconfig::HostnameReader.new.hostname + def static_hostname + Y2Network::Sysconfig::HostnameReader.new.static_hostname + end + + # Returns the value for the dhcp_hostname option selected in the profile. + # If the option is not present then it is read from the system + # + # @return [String] + def dhcp_hostname_for(section_value) + # The autoyast network configuration is usually merge with current + # config, but we do not want to override current config if the value is + # not present and the merge is missing for whatever reason, for example + # in case AutoYaST is called in config mode + return Y2Network::Sysconfig::HostnameReader.new.dhcp_hostname if section_value.nil? + + section_value ? :any : :none end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/y2network/autoinst/s390_devices_reader.rb new/yast2-network-4.2.65/src/lib/y2network/autoinst/s390_devices_reader.rb --- old/yast2-network-4.2.60/src/lib/y2network/autoinst/s390_devices_reader.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/y2network/autoinst/s390_devices_reader.rb 2020-04-02 15:02:55.000000000 +0200 @@ -66,18 +66,30 @@ end def load_qeth(config, device_section) - chanids = device_section.chanids - config.read_channel, config.write_channel, config.data_channel = chanids.split(" ") + config.read_channel, config.write_channel, config.data_channel = + chanids_from(device_section.chanids) config.layer2 = device_section.layer2 end def load_ctc(config, device_section) - config.read_channel, config.write_channel = device_section.chanids.split(" ") + config.read_channel, config.write_channel = chanids_from(device_section.chanids) config.protocol = device_section.protocol end def load_lcs(config, device_section) - config.read_channel, config.write_channel = device_section.chanids.split(" ") + config.read_channel, config.write_channel = chanids_from(device_section.chanids) + end + + # Separator used for the list of channel IDs + CHANIDS_SEPARATOR = ":".freeze + private_constant :CHANIDS_SEPARATOR + + # Returns the list of channel IDs from a string + # + # @param ids [String] String representing the channel IDs + # @return [Array<String>] + def chanids_from(ids) + ids.to_s.split(CHANIDS_SEPARATOR) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/y2network/autoinst_profile/s390_device_section.rb new/yast2-network-4.2.65/src/lib/y2network/autoinst_profile/s390_device_section.rb --- old/yast2-network-4.2.60/src/lib/y2network/autoinst_profile/s390_device_section.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/y2network/autoinst_profile/s390_device_section.rb 2020-04-02 15:02:55.000000000 +0200 @@ -44,7 +44,7 @@ define_attr_accessors # @!attribute chanids - # @return [String] channel device id separated by spaces + # @return [String] channel device id separated by spaces or colons # @!attribute layer2 # @return [Boolean] Whether layer2 is enabler or not @@ -71,6 +71,17 @@ result end + # Creates an instance based on the profile representation used by the AutoYaST modules + # (array of hashes objects). + # + # @param hash [Hash] Networking section from an AutoYaST profile + # @return [S390DeviceSection] + def self.new_from_hashes(hash) + result = new + result.init_from_hashes(hash) + result + end + # Method used by {.new_from_network} to populate the attributes when cloning a network s390 # device # @@ -91,6 +102,26 @@ true end + + # Method used by {.new_from_hashes} to populate the attributes when importing a profile + # + # @param hash [Hash] see {.new_from_hashes} + def init_from_hashes(hash) + super + self.chanids = normalized_chanids(hash["chanids"]) if hash["chanids"] + end + + private + + # Normalizes the list of channel IDs + # + # It replaces spaces with colons. + # + # @param ids [String] String representing the channel IDs + # @return [String] + def normalized_chanids(ids) + ids.gsub(/\ +/, ":") + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/y2network/hwinfo.rb new/yast2-network-4.2.65/src/lib/y2network/hwinfo.rb --- old/yast2-network-4.2.60/src/lib/y2network/hwinfo.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/y2network/hwinfo.rb 2020-04-02 15:02:55.000000000 +0200 @@ -37,7 +37,7 @@ read_hardware @netcards = ReadHardware("netcard").map do |attrs| name = attrs["dev_name"] - extra_attrs = name ? extra_attrs_for(name) : {} + extra_attrs = name.to_s.empty? ? {} : extra_attrs_for(name) Hwinfo.new(attrs.merge(extra_attrs)) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/y2network/sysconfig/hostname_reader.rb new/yast2-network-4.2.65/src/lib/y2network/sysconfig/hostname_reader.rb --- old/yast2-network-4.2.60/src/lib/y2network/sysconfig/hostname_reader.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/y2network/sysconfig/hostname_reader.rb 2020-04-02 15:02:55.000000000 +0200 @@ -106,12 +106,19 @@ nil end - # Reads the system (local) hostname + # Reads the transient hostname or system (local) hostname # # @return [String, nil] Hostname def hostname_from_system Yast::Execute.on_target!("/usr/bin/hostname", stdout: :capture).strip rescue Cheetah::ExecutionFailed + static_hostname + end + + # Reads the static hostname from /etc/hostname + # + # @return [String, nil] + def static_hostname name = Yast::SCR.Read(Yast::Path.new(".target.string"), "/etc/hostname").to_s.strip name.empty? ? nil : name end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/lib/y2network/sysconfig/hostname_writer.rb new/yast2-network-4.2.65/src/lib/y2network/sysconfig/hostname_writer.rb --- old/yast2-network-4.2.60/src/lib/y2network/sysconfig/hostname_writer.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/lib/y2network/sysconfig/hostname_writer.rb 2020-04-02 15:02:55.000000000 +0200 @@ -73,7 +73,7 @@ # # @param hostname [Y2Network::Hostname] Hostname configuration def update_hostname(hostname) - hostname = hostname.static + hostname = hostname.static.to_s # 1) when user asked for erasing hostname from /etc/hostname, we keep runtime as it is # 2) we will write whatever user wants even FQDN - no changes under the hood Yast::Execute.locally!("/usr/bin/hostname", hostname) if !hostname.empty? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/modules/Lan.rb new/yast2-network-4.2.65/src/modules/Lan.rb --- old/yast2-network-4.2.60/src/modules/Lan.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/modules/Lan.rb 2020-04-02 15:02:55.000000000 +0200 @@ -44,6 +44,7 @@ module Yast class LanClass < Module include ::UI::TextHelpers + include Wicked def main Yast.import "UI" @@ -505,6 +506,8 @@ target = :sysconfig if Mode.auto yast_config.write(original: system_config, target: target) + # Force a refresh of the system_config bsc#1162987 + add_config(:system, yast_config.copy) Progress.set(orig) Builtins.sleep(sl) @@ -861,29 +864,23 @@ # ssh, we should not restart network because systemctl # hangs in that case. (bnc#885640) action = :reload_restart if Stage.normal || !Linuxrc.usessh - action = :force_restart if LanItems.force_restart action = :remote_installer if Stage.initial && (Linuxrc.usessh || Linuxrc.vnc) case action - when :force_restart - log.info("Network service activation forced") - NetworkService.Restart - when :reload_restart log.info("Attempting to reload network service, normal stage #{Stage.normal}, " \ "ssh: #{Linuxrc.usessh}") NetworkService.ReloadOrRestart if Stage.normal || !Linuxrc.usessh - when :remote_installer - ifaces = LanItems.getNetworkInterfaces + connection_names = yast_config&.connections&.map(&:name) || [] # last instance handling "special" cases like ssh installation # FIXME: most probably not everything will be set properly log.info("Running in ssh/vnc installer -> just setting links up") - log.info("Available interfaces: #{ifaces}") + log.info("Configured connections: #{connection_names}") - LanItems.reload_config(ifaces) + reload_config(connection_names) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/src/modules/LanItems.rb new/yast2-network-4.2.65/src/modules/LanItems.rb --- old/yast2-network-4.2.60/src/modules/LanItems.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/src/modules/LanItems.rb 2020-04-02 15:02:55.000000000 +0200 @@ -65,9 +65,6 @@ # Which operation is pending? @operation = nil - # in special cases when rcnetwork reload is not enought - @force_restart = false - @description = "" @type = "" @@ -800,7 +797,6 @@ publish_variable :driver_options, "map <string, any>" publish_variable :autoinstall_settings, "map" publish_variable :operation, "symbol" - publish_variable :force_restart, "boolean" publish_variable :description, "string" publish_variable :type, "string" # note: read-only param. Any modification is ignored. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/test/lan_test.rb new/yast2-network-4.2.65/test/lan_test.rb --- old/yast2-network-4.2.60/test/lan_test.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/test/lan_test.rb 2020-04-02 15:02:55.000000000 +0200 @@ -80,14 +80,20 @@ end describe "#activate_network_service" do + Yast.import "Stage" Yast.import "NetworkService" - let(:force_restart) { false } + let(:yast_config) { instance_double(Y2Network::Config, "YaST", connections: collection) } + let(:collection) { [eth0, eth1] } + + let(:eth0) { Y2Network::ConnectionConfig::Ethernet.new.tap { |c| c.name = "eth0" } } + let(:eth1) { Y2Network::ConnectionConfig::Ethernet.new.tap { |c| c.name = "eth1" } } + let(:installation) { false } before do - allow(Yast::LanItems).to receive(:force_restart).and_return(force_restart) + subject.add_config(:yast, yast_config) allow(Yast::Stage).to receive(:normal).and_return(!installation) allow(Yast::Stage).to receive(:initial).and_return(installation) end @@ -101,41 +107,32 @@ end context "when asked in normal mode" do - context "and a restart is not forced" do - it "tries to reload network service" do - expect(Yast::NetworkService) - .to receive(:ReloadOrRestart) - - Yast::Lan.send(:activate_network_service) - end - end - - context "and a restart is forced" do - let(:force_restart) { true } - - it "tries to restart the network service" do - expect(Yast::NetworkService) - .to receive(:Restart) + it "tries to reload network service" do + expect(Yast::NetworkService) + .to receive(:ReloadOrRestart) - Yast::Lan.send(:activate_network_service) - end + Yast::Lan.send(:activate_network_service) end end context "when asked during installation" do let(:installation) { true } - it "updates network service according usessh flag" do - if ssh_flag - expect(Yast::NetworkService) - .not_to receive(:ReloadOrRestart) - else + if ssh_flag + it "reloads configured connections" do + expect(subject).to receive(:reload_config).with(["eth0", "eth1"]) + + Yast::Lan.send(:activate_network_service) + end + else + it "tries to reload or restart the networkservice" do expect(Yast::NetworkService) .to receive(:ReloadOrRestart) - end - Yast::Lan.send(:activate_network_service) + Yast::Lan.send(:activate_network_service) + end end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/test/network_autoyast_test.rb new/yast2-network-4.2.65/test/network_autoyast_test.rb --- old/yast2-network-4.2.60/test/network_autoyast_test.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/test/network_autoyast_test.rb 2020-04-02 15:02:55.000000000 +0200 @@ -23,6 +23,8 @@ require "network/network_autoyast" require "y2network/sysconfig/config_reader" +require "y2network/s390_device_activators/qeth" + Yast.import "Profile" Yast.import "Lan" @@ -30,7 +32,7 @@ subject(:network_autoyast) { Yast::NetworkAutoYast.instance } let(:config) do Y2Network::Config.new( - interfaces: [], + interfaces: Y2Network::InterfacesCollection.new([]), routing: Y2Network::Routing.new(tables: []), dns: Y2Network::DNS.new, source: :sysconfig @@ -341,4 +343,54 @@ end end end + + describe "#activate_s390_devices" do + let(:section) do + [ + { + "chanids" => "0.0.0800 0.0.0801 0.0.0802", + "type" => "qeth" + } + ] + end + + let(:activator) do + instance_double( + Y2Network::S390DeviceActivators::Qeth, + configured_interface: configured_interface + ) + end + + let(:configured_interface) { "" } + + before do + allow(Y2Network::S390DeviceActivators::Qeth).to receive(:new) + .and_return(activator) + end + + it "activates the given device" do + expect(activator).to receive(:configure) + subject.activate_s390_devices(section) + end + + context "if the device is already active" do + let(:configured_interface) { "eth0" } + + it "does not activate the device" do + expect(activator).to_not receive(:configure) + subject.activate_s390_devices(section) + end + end + + context "if the activation fails" do + before do + allow(activator).to receive(:configure).and_raise(RuntimeError) + end + + it "logs the error" do + expect(subject.log).to receive(:error).at_least(1) + subject.activate_s390_devices(section) + end + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/test/y2network/autoinst/config_reader_test.rb new/yast2-network-4.2.65/test/y2network/autoinst/config_reader_test.rb --- old/yast2-network-4.2.60/test/y2network/autoinst/config_reader_test.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/test/y2network/autoinst/config_reader_test.rb 2020-04-02 15:02:55.000000000 +0200 @@ -58,7 +58,8 @@ "ipv4_forward" => true, "ipv6_forward" => false, "routes" => routes - } + }, + "dns" => dns } end @@ -67,6 +68,8 @@ expect(subject.config).to be_a Y2Network::Config expect(subject.config.routing).to be_a Y2Network::Routing expect(subject.config.dns).to be_a Y2Network::DNS + expect(subject.config.hostname.dhcp_hostname).to eq(:any) + expect(subject.config.hostname.installer).to eq("host") end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/test/y2network/autoinst/hostname_reader_test.rb new/yast2-network-4.2.65/test/y2network/autoinst/hostname_reader_test.rb --- old/yast2-network-4.2.60/test/y2network/autoinst/hostname_reader_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-4.2.65/test/y2network/autoinst/hostname_reader_test.rb 2020-04-02 15:02:55.000000000 +0200 @@ -0,0 +1,76 @@ +#!/usr/bin/env rspec + +# 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 "y2network/autoinst/hostname_reader" + +describe Y2Network::Autoinst::HostnameReader do + let(:subject) { described_class.new(dns_section) } + + let(:dns_section) do + Y2Network::AutoinstProfile::DNSSection.new_from_hashes(profile["dns"]) + end + + let(:current_static_hostname) { "test" } + let(:current_dhcp_hostname) { :any } + + before do + allow_any_instance_of(Y2Network::Sysconfig::HostnameReader) + .to receive(:static_hostname).and_return(current_static_hostname) + allow_any_instance_of(Y2Network::Sysconfig::HostnameReader) + .to receive(:dhcp_hostname).and_return(current_dhcp_hostname) + end + + let(:profile) do + { + "dns" => { + "hostname" => "host", + "dhcp_hostname" => false, "write_hostname" => true + } + } + end + + describe "#config" do + it "builds a new Y2Network::Hostname config from the profile dns section" do + config = subject.config + expect(config).to be_a Y2Network::Hostname + expect(config.installer).to eq("host") + expect(config.dhcp_hostname).to eq(:none) + expect(config.static).to eq("host") + end + + context "when no hostname option is defined" do + let(:profile) { { "dns" => { "dhcp_hostname" => true } } } + + it "reads the current hostname configuration from the system" do + expect(subject.config.hostname).to eq(current_static_hostname) + end + end + + context "when no dhcp_hostname option is defined" do + let(:profile) { { "dns" => { "hostname" => "another_host" } } } + + it "reads the current dhcp_hostname configuration from the system" do + expect(subject.config.dhcp_hostname).to eq(current_dhcp_hostname) + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/test/y2network/autoinst/s390_devices_reader_test.rb new/yast2-network-4.2.65/test/y2network/autoinst/s390_devices_reader_test.rb --- old/yast2-network-4.2.60/test/y2network/autoinst/s390_devices_reader_test.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/test/y2network/autoinst/s390_devices_reader_test.rb 2020-04-02 15:02:55.000000000 +0200 @@ -51,8 +51,19 @@ describe "#config" do it "builds a new Y2Network::ConnectionConfigsCollection" do - expect(subject.config).to be_a Y2Network::ConnectionConfigsCollection - expect(subject.config.size).to eq(2) + expect(subject.config).to contain_exactly( + an_object_having_attributes( + read_channel: "0.0.0700", + write_channel: "0.0.0701", + data_channel: "0.0.0702" + ), + an_object_having_attributes( + read_channel: "0.0.0800", + write_channel: "0.0.0801", + data_channel: "0.0.0802", + layer2: true + ) + ) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.60/test/y2network/autoinst_profile/s390_device_section_test.rb new/yast2-network-4.2.65/test/y2network/autoinst_profile/s390_device_section_test.rb --- old/yast2-network-4.2.60/test/y2network/autoinst_profile/s390_device_section_test.rb 2020-03-04 08:24:53.000000000 +0100 +++ new/yast2-network-4.2.65/test/y2network/autoinst_profile/s390_device_section_test.rb 2020-04-02 15:02:55.000000000 +0200 @@ -59,10 +59,26 @@ } end - it "loads properly boot protocol" do + it "loads properly type, chanids and boot protocol" do section = described_class.new_from_hashes(hash) expect(section.type).to eq "ctc" + expect(section.chanids).to eq("0.0.0800:0.0.0801") expect(section.protocol).to eq "1" end + + context "using the old syntax for chanids" do + let(:hash) do + { + "type" => "ctc", + "chanids" => "0.0.0800 0.0.0801", + "protocol" => "1" + } + end + + it "loads properly the chanids" do + section = described_class.new_from_hashes(hash) + expect(section.chanids).to eq("0.0.0800:0.0.0801") + end + end end end
