Skip to content

Commit

Permalink
Merge pull request #1119 from yast/fix_connection_config_comparison
Browse files Browse the repository at this point in the history
Fix connection_config equality comparison
  • Loading branch information
teclator committed Nov 20, 2020
2 parents 0c0d9d3 + 1ae7b22 commit 9947b68
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 2 deletions.
6 changes: 6 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 20 07:23:27 UTC 2020 - Knut Anderssen <kanderssen@suse.com>

- Fixed detection of connection configuration changes (bsc#1178950)
- 4.2.84

-------------------------------------------------------------------
Tue Oct 13 12:57:36 UTC 2020 - Michal Filka <mfilka@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 4.2.83
Version: 4.2.84
Release: 0
Summary: YaST2 - Network Configuration
License: GPL-2.0-only
Expand Down
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/bonding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def ==(other)
options == other.options && ((slaves - other.slaves) + (other.slaves - slaves)).empty?
end

alias_method :eql?, :==

def virtual?
true
end
Expand Down
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def ==(other)
stp == other.stp && forward_delay == other.forward_delay &&
((ports - other.ports) + (other.ports - ports)).empty?
end

alias_method :eql?, :==
end
end
end
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/ctc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def ==(other)
end
end

alias_method :eql?, :==

# Returns the complete device id which contains the read ad write
# channels joined by ':'
#
Expand Down
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/infiniband.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def ==(other)
public_send(method) == other.public_send(method)
end
end

alias_method :eql?, :==
end
end
end
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/ip_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def ==(other)
remote_address == other.remote_address && broadcast == other.broadcast &&
id == other.id
end

alias_method :eql?, :==
end
end
end
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/lcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def ==(other)
end
end

alias_method :eql?, :==

# Returns the complete device id which contains the read ad write
# channels joined by ':'
#
Expand Down
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/qeth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def ==(other)
end
end

alias_method :eql?, :==

# Returns the complete device id which contains the read, write and data
# channels joined by ':'
#
Expand Down
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def ==(other)
public_send(method) == other.public_send(method)
end
end

alias_method :eql?, :==
end
end
end
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/tun.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def ==(other)
public_send(method) == other.public_send(method)
end
end

alias_method :eql?, :==
end
end
end
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/vlan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def ==(other)
public_send(method) == other.public_send(method)
end
end

alias_method :eql?, :==
end
end
end
2 changes: 2 additions & 0 deletions src/lib/y2network/connection_config/wireless.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def ==(other)
end
end

alias_method :eql?, :==

# @param wireless_mode [String]
def mode=(wireless_mode)
@mode = wireless_mode.to_s.downcase
Expand Down
16 changes: 15 additions & 1 deletion test/y2network/config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@
end

describe "#==" do
let(:bond0) { Y2Network::VirtualInterface.new("bond0") }
let(:bond0_conn) do
Y2Network::ConnectionConfig::Bonding.new.tap do |conn|
conn.interface = "bond0"
conn.name = "bond0"
conn.slaves = ["eth0"]
end
end

let(:interfaces) { Y2Network::InterfacesCollection.new([eth0, bond0]) }
let(:connections) { Y2Network::ConnectionConfigsCollection.new([eth0_conn, bond0_conn]) }

let(:copy) { config.copy }

context "when both configuration contains the same information" do
Expand All @@ -154,7 +166,9 @@

context "when connection list is different" do
it "returns false" do
copy.connections = Y2Network::ConnectionConfigsCollection.new([])
modified_bond = copy.connections.by_name("bond0")
modified_bond.options = "mode=active-backup miimon=300"

expect(copy).to_not eq(config)
end
end
Expand Down

0 comments on commit 9947b68

Please sign in to comment.