Skip to content

Commit

Permalink
Fix reading zVM device or protocol when no exist
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Feb 6, 2019
1 parent dd3cb4c commit 0c66d86
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/modules/LanItems.rb
Expand Up @@ -2698,9 +2698,18 @@ def export_udevs(devices)
if !chan_ids["stdout"].empty?
chanids = String.CutBlanks(Ops.get_string(chan_ids, "stdout", ""))
end

# we already know that kernel device exist, otherwise next above would apply
portname = ::File.read("/sys/class/net/#{device}/device/portname").strip
protocol = ::File.read("/sys/class/net/#{device}/device/protocol").strip
# FIXME: It seems that it is not always the case (bsc#1124002)
begin
portname = ::File.read("/sys/class/net/#{device}/device/portname").strip
protocol = ::File.read("/sys/class/net/#{device}/device/protocol").strip
rescue SystemCallError => e
log.error("Failed to read portname or protocol: #{e.inspect}")
portname = ""
protocol = ""
end

layer2_ret = SCR.Execute(
path(".target.bash"),
Builtins.sformat(
Expand Down

0 comments on commit 0c66d86

Please sign in to comment.