B #3305: OpenvSwitch “del_flows” traceback (#3304)

The “del_flows” override the loop variable “m” when matching the port,
on the second loop which result in the following error.

    /var/tmp/one/vnm/ovswitch/OpenvSwitch.rb:287:in `match': wrong
    argument type MatchData (expected Regexp) (TypeError)

* src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb: use a different variable
  name when matching the port than the loop iterator.

Signed-off-by: Daniel Dehennin <daniel.dehennin@ac-dijon.fr>
(cherry picked from commit 2e13e8eb53)
This commit is contained in:
Daniel authored and Ruben S. Montero committed 2019-05-09 11:31:49 +02:00
1 parent 12e92c87a9
commit 83bbad6101
1 file changed
+4 -4
+4 -4
View File
@@ -282,12 +282,12 @@ class OpenvSwitchVLAN < VNMMAD::VNMDriver
# searching for flow just by MAC address is legacy,
# we preferably look for a flow port with our note
["note:#{port_note}", @nic[:mac]].each do |m|
["note:#{port_note}", @nic[:mac]].each do |flow_matching|
out_flows.lines do |flow|
next unless flow.match(m)
next unless flow.match(flow_matching)
if (m = flow.match(/in_port=(\d+)/))
in_port_tmp = m[1]
if (port_match = flow.match(/in_port=(\d+)/))
in_port_tmp = port_match[1]
if !the_ports.include?(in_port_tmp)
in_port = in_port_tmp