diff --git a/package/yast2-network.changes b/package/yast2-network.changes index 5b95b4a58..fdcaf226e 100644 --- a/package/yast2-network.changes +++ b/package/yast2-network.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Jun 13 12:11:42 UTC 2023 - Michal Filka + +- bsc#1211431 + - Do not crash installation when storing vlan configuration into + NetworkManager +- 4.4.58 + ------------------------------------------------------------------- Wed May 10 07:29:32 UTC 2023 - Knut Anderssen diff --git a/package/yast2-network.spec b/package/yast2-network.spec index 9fdc5dc47..e1e457c41 100644 --- a/package/yast2-network.spec +++ b/package/yast2-network.spec @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.4.57 +Version: 4.4.58 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only diff --git a/src/lib/y2network/network_manager/connection_config_writers/vlan.rb b/src/lib/y2network/network_manager/connection_config_writers/vlan.rb index cc5bc8de3..5d74da7ef 100644 --- a/src/lib/y2network/network_manager/connection_config_writers/vlan.rb +++ b/src/lib/y2network/network_manager/connection_config_writers/vlan.rb @@ -28,7 +28,7 @@ class Vlan < Base # @see Y2Network::ConnectionConfigWriters::Base#update_file # @param conn [Y2Network::ConnectionConfig::Vlan] Configuration to write def update_file(conn) - file.vlan["id"] = conn.vlan_id + file.vlan["id"] = conn.vlan_id.to_s file.vlan["parent"] = conn.parent_device file.vlan["type"] = "vlan" end diff --git a/test/y2network/network_manager/connection_config_writers/vlan_test.rb b/test/y2network/network_manager/connection_config_writers/vlan_test.rb new file mode 100644 index 000000000..2c8afb020 --- /dev/null +++ b/test/y2network/network_manager/connection_config_writers/vlan_test.rb @@ -0,0 +1,45 @@ +# Copyright (c) [2021] 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/network_manager/connection_config_writers/vlan" +require "cfa/nm_connection" +require "y2network/boot_protocol" +require "y2network/startmode" +require "y2network/connection_config/vlan" + +describe Y2Network::NetworkManager::ConnectionConfigWriters::Vlan do + subject(:handler) { described_class.new(file) } + let(:file) { CFA::NmConnection.new("bond0.nm_connection") } + + let(:conn) do + Y2Network::ConnectionConfig::Vlan.new.tap do |c| + c.interface = "eth0.1006" + c.vlan_id = 1006 + end + end + + describe "#write" do + it "sets device and IP relevant attributes" do + handler.write(conn) + expect(file.vlan["type"]).to eql("vlan") + expect(file.vlan["id"]).to eql("1006") + end + end +end