Skip to content

Commit

Permalink
Do not rescue but just check that the file exist
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Feb 6, 2019
1 parent 79a7405 commit 0009046
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/modules/LanItems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2701,14 +2701,11 @@ def export_udevs(devices)

# we already know that kernel device exist, otherwise next above would apply
# 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
portname_file = "/sys/class/net/#{device}/device/portname"
portname = ::File.exist? ? ::File.read(portname_file).strip : ""

protocol_file = "/sys/class/net/#{device}/device/protocol").strip
protocol = ::File.exist? ? ::File.read(protocol_file).strip : ""

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

0 comments on commit 0009046

Please sign in to comment.