Skip to content

Commit

Permalink
Locate returns interface names instead of types (bsc#998717) (#494)
Browse files Browse the repository at this point in the history
* Network: NetworkInterfaces.Locate returns interface names instead of interface types (bsc#998717).
  • Loading branch information
teclator committed Sep 19, 2016
1 parent deb073e commit 1bbea0a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
12 changes: 8 additions & 4 deletions library/network/src/modules/NetworkInterfaces.rb
Expand Up @@ -1618,8 +1618,10 @@ def GetIP(device)
def Locate(key, val)
ret = []

@Devices.each do |device, devsmap|
ret << device if devsmap.any? { |_t, d| d[key] == val }
@Devices.values.each do |devsmap|
devsmap.each do |device, conf|
ret << device if conf[key] == val
end
end

ret
Expand All @@ -1633,8 +1635,10 @@ def Locate(key, val)
def LocateNOT(key, val)
ret = []

@Devices.each do |device, devsmap|
ret << device if devsmap.any? { |_t, d| d[key] != val }
@Devices.values.each do |devsmap|
devsmap.each do |device, conf|
ret << device if conf[key] != val
end
end

ret
Expand Down
10 changes: 5 additions & 5 deletions library/network/test/network_interfaces_test.rb
Expand Up @@ -198,9 +198,9 @@
subject.CleanCacheRead
end

it "returns an array of devices types which have got given key,value" do
expect(subject.Locate("BOOTPROTO", "static")).to eql(["bond", "em", "eth"])
expect(subject.Locate("BONDING_MASTER", "YES")).to eql(["bond"])
it "returns an array of devices which have got given key,value" do
expect(subject.Locate("BOOTPROTO", "static")).to eql(["bond0", "em1", "eth0", "eth1"])
expect(subject.Locate("BONDING_MASTER", "YES")).to eql(["bond0"])
end

it "returns an empty array if not device match given criteria" do
Expand All @@ -219,8 +219,8 @@
subject.CleanCacheRead
end

it "returns an array of devices types which have got a different key,value than given ones" do
expect(subject.LocateNOT("BOOTPROTO", "static")).to eql(["arc", "br", "ppp", "vlan"])
it "returns an array of devices which have got a different key,value than given ones" do
expect(subject.LocateNOT("BOOTPROTO", "static")).to eql(["arc5", "br1", "ppp0", "vlan3"])
end
end

Expand Down
9 changes: 9 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Sep 16 17:53:15 UTC 2016 - kanderssen@suse.com

- Network: Fix bug introduced during NetworkInterfaces.Read cleanup
The method Networkinterfaces.Locate now returns the interface
name of the interfaces that match the given condition instead of
the type. (bsc#998717)
- 3.1.206

-------------------------------------------------------------------
Fri Aug 26 10:37:45 UTC 2016 - kanderssen@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2
Version: 3.1.205
Version: 3.1.206
Release: 0
Summary: YaST2 - Main Package
License: GPL-2.0
Expand Down

0 comments on commit 1bbea0a

Please sign in to comment.