Skip to content

Commit 00450dd

Browse files
B OpenNebula#4732: test PHYDEV for empty string
1 parent 3582f79 commit 00450dd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/vnm_mad/remotes/lib/no_vlan.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def activate
4747
TProxy.setup_tproxy(@nic, :up)
4848

4949
# Skip if vlan device is already in the bridge.
50-
next if !@nic[:phydev] || @nic[:phydev].empty? ||
50+
next if @nic[:phydev].nil? || @nic[:phydev].empty? ||
5151
@bridges[@nic[:bridge]].include?(@nic[:phydev])
5252

5353
# Add phydev device to the bridge.
@@ -178,7 +178,8 @@ def vlan_filter
178178
process do |nic|
179179
@nic = nic
180180

181-
next if @nic[:phydev].nil? || @nic[:bridge].nil? || !@nic.vlan_trunk?
181+
next if @nic[:phydev].nil? || @nic[:phydev].empty?
182+
next if @nic[:bridge].nil? || !@nic.vlan_trunk?
182183

183184
vlan_set = @nic.vlan_trunk
184185

src/vnm_mad/remotes/lib/vlan.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def activate
4545
process do |nic|
4646
@nic = nic
4747

48-
next if @nic[:phydev].nil?
48+
next if @nic[:phydev].nil? || @nic[:phydev].empty?
4949

5050
# generate the name of the vlan device.
5151
gen_vlan_dev_name
@@ -111,7 +111,7 @@ def deactivate
111111

112112
@nic = nic
113113

114-
next if @nic[:phydev].nil?
114+
next if @nic[:phydev].nil? || @nic[:phydev].empty?
115115
next if @bridges[@nic[:bridge]].nil?
116116

117117
# Get the name of the vlan device.
@@ -167,7 +167,7 @@ def update(vnet_id)
167167
process do |nic|
168168
next unless Integer(nic[:network_id]) == vnet_id
169169

170-
next if nic[:phydev].nil?
170+
next if nic[:phydev].nil? || nic[:phydev].empty?
171171

172172
# the bridge should already exist as we're updating
173173
next if @bridges[nic[:bridge]].nil?

0 commit comments

Comments
 (0)