Skip to content

Commit

Permalink
More robust FcoeClient (when vlan_fcoe is an empty string)
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Feb 20, 2020
1 parent 855334e commit bbf3362
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/modules/FcoeClient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,8 @@ def AutoPackages
# @param card [Hash] a hash with all the information about a network interface
# @return [String, nil] nil if no FCoE VLAN is configured for the given interface
def fcoe_vlan(card)
fcoe_vlan = card.fetch("fcoe_vlan", "")
fcoe_vlan = card["fcoe_vlan"]
return nil if fcoe_vlan.nil? || fcoe_vlan.empty?
return nil if fcoe_vlan == @NOT_AVAILABLE || fcoe_vlan == @NOT_CONFIGURED

fcoe_vlan
Expand Down
4 changes: 3 additions & 1 deletion test/fcoe_client_write_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
let(:interfaces) do
[
{ "dev_name" => "eth0", "fcoe_vlan" => "not available" },
{ "dev_name" => "eth1", "fcoe_vlan" => "not configured" }
{ "dev_name" => "eth1", "fcoe_vlan" => "not configured" },
{ "dev_name" => "eth2", "fcoe_vlan" => "" },
]
end

Expand All @@ -46,6 +47,7 @@
[
{ "dev_name" => "eth0", "fcoe_vlan" => "not available" },
{ "dev_name" => "eth1", "fcoe_vlan" => "eth1.500-fcoe" },
{ "dev_name" => "eth2", "fcoe_vlan" => "" },
]
end

Expand Down

0 comments on commit bbf3362

Please sign in to comment.